@framework-m/plugin-sdk 0.2.3
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/LICENSE +202 -0
- package/dist/context/PluginRegistryContext.d.ts +23 -0
- package/dist/context/PluginRegistryContext.d.ts.map +1 -0
- package/dist/core/PluginRegistry.d.ts +130 -0
- package/dist/core/PluginRegistry.d.ts.map +1 -0
- package/dist/core/ServiceContainer.d.ts +31 -0
- package/dist/core/ServiceContainer.d.ts.map +1 -0
- package/dist/hooks/usePlugin.d.ts +3 -0
- package/dist/hooks/usePlugin.d.ts.map +1 -0
- package/dist/hooks/usePluginMenu.d.ts +3 -0
- package/dist/hooks/usePluginMenu.d.ts.map +1 -0
- package/dist/hooks/useService.d.ts +24 -0
- package/dist/hooks/useService.d.ts.map +1 -0
- package/dist/hooks/useWidgets.d.ts +3 -0
- package/dist/hooks/useWidgets.d.ts.map +1 -0
- package/dist/index.cjs +2 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +39 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +594 -0
- package/dist/index.js.map +1 -0
- package/dist/types/plugin.d.ts +157 -0
- package/dist/types/plugin.d.ts.map +1 -0
- package/package.json +64 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/core/ServiceContainer.ts","../src/core/PluginRegistry.ts","../src/context/PluginRegistryContext.tsx","../src/hooks/usePluginMenu.ts","../src/hooks/usePlugin.ts","../src/hooks/useService.ts","../src/hooks/useWidgets.ts"],"sourcesContent":["/**\n * ServiceContainer — Simple dependency injection for plugin services.\n *\n * Services are registered as factories and lazily instantiated as singletons\n * on first `get()` call. Supports both sync and async factories.\n *\n * @example\n * ```ts\n * const container = new ServiceContainer();\n * container.register(\"warehouseService\", () => new WarehouseService());\n * const svc = await container.get<WarehouseService>(\"warehouseService\");\n * ```\n */\n\nimport type { ServiceFactory } from \"../types/plugin\";\n\nexport class ServiceContainer {\n private readonly factories = new Map<string, ServiceFactory>();\n private readonly instances = new Map<string, unknown>();\n\n /**\n * Register a service factory.\n *\n * @param name — unique service name\n * @param factory — factory function (sync or async)\n */\n register<T>(name: string, factory: ServiceFactory<T>): void {\n this.factories.set(name, factory as ServiceFactory);\n // Clear cached instance if re-registering\n this.instances.delete(name);\n }\n\n /**\n * Get a service by name. Lazily instantiates on first call (singleton).\n *\n * @throws Error if service is not registered\n */\n async get<T = unknown>(name: string): Promise<T> {\n // Return cached singleton\n if (this.instances.has(name)) {\n return this.instances.get(name) as T;\n }\n\n const factory = this.factories.get(name);\n if (!factory) {\n throw new Error(`Service \"${name}\" is not registered`);\n }\n\n // Create instance (may be async)\n const instance = await Promise.resolve(factory());\n this.instances.set(name, instance);\n return instance as T;\n }\n\n /**\n * Check if a service is registered.\n */\n has(name: string): boolean {\n return this.factories.has(name);\n }\n\n /**\n * Get all registered service names.\n */\n getAll(): string[] {\n return Array.from(this.factories.keys());\n }\n\n /**\n * Clear all registered factories and cached instances.\n */\n clear(): void {\n this.factories.clear();\n this.instances.clear();\n }\n}\n","/**\n * PluginRegistry — Central registry for Framework M plugins.\n *\n * Handles plugin registration, menu merging (by module/category),\n * route aggregation, and service container population.\n *\n * Per ADR-0008: this is the core runtime that the shell app bootstraps\n * and provides to all components via React Context.\n */\n\nimport type {\n FrameworkMPlugin,\n MenuItem,\n RouteDefinition,\n CompatibilityReport,\n PluginRegistryDiagnostic,\n PluginRegistryDiagnosticSeverity,\n PermissionChecker,\n Widget,\n} from \"../types/plugin\";\nimport { ServiceContainer } from \"./ServiceContainer\";\n\ntype PluginRegistryEvent = \"plugin:registered\" | \"plugin:error\";\n\ntype PluginRegistryEventPayloadMap = {\n \"plugin:registered\": { plugin: FrameworkMPlugin };\n \"plugin:error\": { plugin: FrameworkMPlugin; error: unknown };\n};\n\ntype PluginRegistryEventHandler<E extends PluginRegistryEvent> = (\n payload: PluginRegistryEventPayloadMap[E],\n) => void;\n\n/**\n * SDK version — used for compatibility checking.\n */\nexport const SDK_VERSION = \"0.1.0\";\n\n/**\n * Default icon mapping for well-known module names.\n */\nconst MODULE_ICONS: Record<string, string> = {\n Sales: \"shopping-cart\",\n Inventory: \"package\",\n HR: \"users\",\n Finance: \"dollar-sign\",\n Core: \"settings\",\n Other: \"folder\",\n};\n\nfunction isDebugEnabled(): boolean {\n const globalFlag = (globalThis as { __FRAMEWORK_M_PLUGIN_DEBUG__?: unknown })\n .__FRAMEWORK_M_PLUGIN_DEBUG__;\n if (typeof globalFlag === \"boolean\") {\n return globalFlag;\n }\n if (typeof globalFlag === \"string\") {\n return [\"1\", \"true\", \"yes\", \"on\"].includes(globalFlag.toLowerCase());\n }\n\n const processRef = (\n globalThis as { process?: { env?: Record<string, string | undefined> } }\n ).process;\n if (processRef?.env) {\n const envFlag = processRef.env.FRAMEWORK_M_PLUGIN_DEBUG;\n if (typeof envFlag === \"string\") {\n return [\"1\", \"true\", \"yes\", \"on\"].includes(envFlag.toLowerCase());\n }\n }\n\n return false;\n}\n\nconst registryLogger = {\n debug(message: string, ...args: unknown[]) {\n if (isDebugEnabled()) {\n console.debug(`[PluginRegistry] ${message}`, ...args);\n }\n },\n};\n\nexport class PluginRegistry {\n private readonly plugins = new Map<string, FrameworkMPlugin>();\n private menuCache: MenuItem[] | null = null;\n private readonly serviceContainer = new ServiceContainer();\n private readonly routeOwners = new Map<string, string>();\n private readonly menuNameOwners = new Map<string, string>();\n private readonly menuRouteOwners = new Map<string, string>();\n private readonly serviceOwners = new Map<string, string>();\n private diagnostics: PluginRegistryDiagnostic[] = [];\n private permissionChecker: PermissionChecker | null = null;\n private readonly eventListeners: {\n [E in PluginRegistryEvent]: Set<PluginRegistryEventHandler<E>>;\n } = {\n \"plugin:registered\": new Set(),\n \"plugin:error\": new Set(),\n };\n\n /**\n * Register a plugin with the registry.\n *\n * validates that the plugin has name and version, checks collisions,\n * stores it, registers any services into the ServiceContainer,\n * and invalidates the menu cache.\n *\n * @throws Error if plugin has no name or version\n */\n async register(plugin: FrameworkMPlugin): Promise<void> {\n if (!plugin.name || !plugin.version) {\n throw new Error(\"Plugin must have name and version\");\n }\n\n const diagnostics = this.validateRegistration(plugin);\n const errors = diagnostics.filter(d => d.severity === \"error\");\n\n if (errors.length > 0) {\n const error = new Error(\n `Plugin \"${plugin.name}\" registration failed: ${errors.map(d => d.message).join(\"; \")}`,\n );\n this.emit(\"plugin:error\", { plugin, error });\n throw error;\n }\n\n const previous = this.plugins.get(plugin.name);\n this.plugins.set(plugin.name, plugin);\n this.rebuildIndexesAndServices();\n\n // Invalidate menu cache\n this.menuCache = null;\n\n try {\n if (plugin.onInit) {\n await Promise.resolve(plugin.onInit());\n }\n } catch (error) {\n if (previous) {\n this.plugins.set(plugin.name, previous);\n } else {\n this.plugins.delete(plugin.name);\n }\n this.rebuildIndexesAndServices();\n this.menuCache = null;\n this.emit(\"plugin:error\", { plugin, error });\n throw error;\n }\n\n if (previous?.onDestroy && previous !== plugin) {\n await Promise.resolve(previous.onDestroy());\n }\n\n this.emit(\"plugin:registered\", { plugin });\n\n const warnings = diagnostics.filter(d => d.severity === \"warning\");\n if (warnings.length > 0) {\n registryLogger.debug(\n `Registered plugin \"${plugin.name}\" with warnings`,\n warnings,\n );\n }\n }\n\n /**\n * Get merged menu tree from all plugins.\n *\n * Collects all MenuItem entries, groups them by `module` (default: \"Other\"),\n * optionally sub-groups by `category`, and sorts by `order`.\n * Result is cached until a new plugin is registered.\n */\n getMenu(): MenuItem[] {\n if (this.menuCache) return this.menuCache;\n\n const allMenus: MenuItem[] = [];\n\n for (const plugin of this.plugins.values()) {\n if (plugin.menu) {\n allMenus.push(...plugin.menu);\n }\n }\n\n if (allMenus.length === 0) {\n this.menuCache = [];\n return this.menuCache;\n }\n\n this.menuCache = this.mergeMenus(allMenus);\n return this.menuCache;\n }\n\n /**\n * Get aggregated routes from all plugins.\n */\n getRoutes(): RouteDefinition[] {\n const routes: RouteDefinition[] = [];\n for (const plugin of this.plugins.values()) {\n if (plugin.routes) {\n routes.push(...plugin.routes);\n }\n }\n return routes;\n }\n\n /**\n * Get a specific plugin by name.\n */\n getPlugin(name: string): FrameworkMPlugin | undefined {\n return this.plugins.get(name);\n }\n\n /**\n * Get all registered plugins.\n */\n getAllPlugins(): FrameworkMPlugin[] {\n return Array.from(this.plugins.values());\n }\n\n /**\n * Get the service container for DI.\n */\n getServiceContainer(): ServiceContainer {\n return this.serviceContainer;\n }\n\n /**\n * Unregister a plugin by name and run cleanup lifecycle if provided.\n */\n async unregister(pluginName: string): Promise<boolean> {\n const plugin = this.plugins.get(pluginName);\n if (!plugin) {\n return false;\n }\n\n this.plugins.delete(pluginName);\n this.rebuildIndexesAndServices();\n this.menuCache = null;\n\n if (plugin.onDestroy) {\n await Promise.resolve(plugin.onDestroy());\n }\n\n return true;\n }\n\n /**\n * Resolve a service instance from the registry-level DI container.\n */\n async getService<T = unknown>(name: string): Promise<T> {\n return this.serviceContainer.get<T>(name);\n }\n\n /**\n * Aggregate all widgets contributed by registered plugins.\n */\n getWidgets(): Widget[] {\n const widgets: Widget[] = [];\n for (const plugin of this.plugins.values()) {\n if (plugin.widgets) {\n widgets.push(...plugin.widgets);\n }\n }\n return widgets;\n }\n\n /**\n * Configure a permission checker used by consumer hooks.\n */\n setPermissionChecker(checker: PermissionChecker | null): void {\n this.permissionChecker = checker;\n }\n\n /**\n * Get the configured permission checker.\n */\n getPermissionChecker(): PermissionChecker | null {\n return this.permissionChecker;\n }\n\n /**\n * Subscribe to plugin lifecycle events.\n */\n on<E extends PluginRegistryEvent>(\n event: E,\n handler: PluginRegistryEventHandler<E>,\n ): () => void {\n this.eventListeners[event].add(\n handler as unknown as PluginRegistryEventHandler<PluginRegistryEvent>,\n );\n return () => {\n this.eventListeners[event].delete(\n handler as unknown as PluginRegistryEventHandler<PluginRegistryEvent>,\n );\n };\n }\n\n /**\n * Get emitted diagnostics.\n */\n getDiagnostics(\n severity?: PluginRegistryDiagnosticSeverity,\n ): PluginRegistryDiagnostic[] {\n if (!severity) {\n return [...this.diagnostics];\n }\n return this.diagnostics.filter(d => d.severity === severity);\n }\n\n /**\n * Clear diagnostics.\n */\n clearDiagnostics(): void {\n this.diagnostics = [];\n }\n\n // -------------------------------------------------------------------------\n // Version Compatibility\n // -------------------------------------------------------------------------\n\n /**\n * Check compatibility of all registered plugins.\n *\n * Returns a report of all plugins with their compatibility status:\n * - SDK version compatibility\n * - Peer plugin dependency satisfaction\n */\n checkCompatibility(): CompatibilityReport[] {\n const reports: CompatibilityReport[] = [];\n\n for (const plugin of this.plugins.values()) {\n const report: CompatibilityReport = {\n name: plugin.name,\n version: plugin.version,\n sdkCompatible: true,\n missingPeerPlugins: [],\n };\n\n // Check SDK version\n if (plugin.minSdkVersion) {\n report.sdkCompatible = this.checkSemverCompat(\n SDK_VERSION,\n plugin.minSdkVersion,\n );\n }\n\n // Check peer plugins\n if (plugin.peerPlugins) {\n for (const peerName of plugin.peerPlugins) {\n if (!this.plugins.has(peerName)) {\n report.missingPeerPlugins.push(peerName);\n }\n }\n }\n\n reports.push(report);\n }\n\n return reports;\n }\n\n // -------------------------------------------------------------------------\n // Private helpers\n // -------------------------------------------------------------------------\n\n /**\n * Simple semver compatibility check.\n * Checks if `current` satisfies `>=required`.\n */\n private checkSemverCompat(current: string, required: string): boolean {\n const clean = required.replace(/^>=?/, \"\");\n const [cMajor, cMinor = 0, cPatch = 0] = current.split(\".\").map(Number);\n const [rMajor, rMinor = 0, rPatch = 0] = clean.split(\".\").map(Number);\n\n if (cMajor !== rMajor) return cMajor > rMajor;\n if (cMinor !== rMinor) return cMinor > rMinor;\n return cPatch >= rPatch;\n }\n\n private validateRegistration(\n plugin: FrameworkMPlugin,\n ): PluginRegistryDiagnostic[] {\n return [\n ...this.validateSdkCompatibility(plugin),\n ...this.validateDuplicatePlugin(plugin),\n ...this.validateRouteCollisions(plugin),\n ...this.validateMenuCollisions(plugin),\n ...this.validateServiceCollisions(plugin),\n ];\n }\n\n private validateSdkCompatibility(\n plugin: FrameworkMPlugin,\n ): PluginRegistryDiagnostic[] {\n const diagnostics: PluginRegistryDiagnostic[] = [];\n\n if (plugin.minSdkVersion) {\n const compatible = this.checkSemverCompat(\n SDK_VERSION,\n plugin.minSdkVersion,\n );\n if (!compatible) {\n diagnostics.push(\n this.addDiagnostic({\n code: \"SDK_INCOMPATIBLE\",\n severity: \"warning\",\n message:\n `Plugin ${plugin.name} requires SDK >=${plugin.minSdkVersion}, ` +\n `current SDK is ${SDK_VERSION}. Plugin may not work correctly.`,\n pluginName: plugin.name,\n key: plugin.minSdkVersion,\n }),\n );\n }\n }\n\n return diagnostics;\n }\n\n private validateDuplicatePlugin(\n plugin: FrameworkMPlugin,\n ): PluginRegistryDiagnostic[] {\n const diagnostics: PluginRegistryDiagnostic[] = [];\n\n if (this.plugins.has(plugin.name)) {\n diagnostics.push(\n this.addDiagnostic({\n code: \"PLUGIN_DUPLICATE\",\n severity: \"warning\",\n message: `Plugin ${plugin.name} is already registered and will be replaced`,\n pluginName: plugin.name,\n conflictingPluginName: plugin.name,\n key: plugin.name,\n }),\n );\n }\n\n return diagnostics;\n }\n\n private validateRouteCollisions(\n plugin: FrameworkMPlugin,\n ): PluginRegistryDiagnostic[] {\n const diagnostics: PluginRegistryDiagnostic[] = [];\n\n const seenRoutePaths = new Set<string>();\n for (const route of plugin.routes ?? []) {\n if (seenRoutePaths.has(route.path)) {\n diagnostics.push(\n this.addDiagnostic({\n code: \"ROUTE_COLLISION\",\n severity: \"error\",\n message: `Duplicate route path \"${route.path}\" inside plugin ${plugin.name}`,\n pluginName: plugin.name,\n conflictingPluginName: plugin.name,\n key: route.path,\n }),\n );\n continue;\n }\n\n seenRoutePaths.add(route.path);\n const existingRouteOwner = this.routeOwners.get(route.path);\n if (existingRouteOwner && existingRouteOwner !== plugin.name) {\n diagnostics.push(\n this.addDiagnostic({\n code: \"ROUTE_COLLISION\",\n severity: \"error\",\n message:\n `Route path \"${route.path}\" from plugin ${plugin.name} ` +\n `conflicts with plugin ${existingRouteOwner}`,\n pluginName: plugin.name,\n conflictingPluginName: existingRouteOwner,\n key: route.path,\n }),\n );\n }\n }\n\n return diagnostics;\n }\n\n private validateMenuCollisions(\n plugin: FrameworkMPlugin,\n ): PluginRegistryDiagnostic[] {\n const diagnostics: PluginRegistryDiagnostic[] = [];\n\n const seenMenuNames = new Set<string>();\n const seenMenuRoutes = new Set<string>();\n for (const item of plugin.menu ?? []) {\n if (seenMenuNames.has(item.name)) {\n diagnostics.push(\n this.addDiagnostic({\n code: \"MENU_NAME_COLLISION\",\n severity: \"error\",\n message: `Duplicate menu name \"${item.name}\" inside plugin ${plugin.name}`,\n pluginName: plugin.name,\n conflictingPluginName: plugin.name,\n key: item.name,\n }),\n );\n } else {\n seenMenuNames.add(item.name);\n const existingNameOwner = this.menuNameOwners.get(item.name);\n if (existingNameOwner && existingNameOwner !== plugin.name) {\n diagnostics.push(\n this.addDiagnostic({\n code: \"MENU_NAME_COLLISION\",\n severity: \"error\",\n message:\n `Menu name \"${item.name}\" from plugin ${plugin.name} ` +\n `conflicts with plugin ${existingNameOwner}`,\n pluginName: plugin.name,\n conflictingPluginName: existingNameOwner,\n key: item.name,\n }),\n );\n }\n }\n\n if (seenMenuRoutes.has(item.route)) {\n diagnostics.push(\n this.addDiagnostic({\n code: \"MENU_ROUTE_COLLISION\",\n severity: \"error\",\n message: `Duplicate menu route \"${item.route}\" inside plugin ${plugin.name}`,\n pluginName: plugin.name,\n conflictingPluginName: plugin.name,\n key: item.route,\n }),\n );\n } else {\n seenMenuRoutes.add(item.route);\n const existingRouteOwner = this.menuRouteOwners.get(item.route);\n if (existingRouteOwner && existingRouteOwner !== plugin.name) {\n diagnostics.push(\n this.addDiagnostic({\n code: \"MENU_ROUTE_COLLISION\",\n severity: \"error\",\n message:\n `Menu route \"${item.route}\" from plugin ${plugin.name} ` +\n `conflicts with plugin ${existingRouteOwner}`,\n pluginName: plugin.name,\n conflictingPluginName: existingRouteOwner,\n key: item.route,\n }),\n );\n }\n }\n }\n\n return diagnostics;\n }\n\n private validateServiceCollisions(\n plugin: FrameworkMPlugin,\n ): PluginRegistryDiagnostic[] {\n const diagnostics: PluginRegistryDiagnostic[] = [];\n\n const seenServiceNames = new Set<string>();\n for (const serviceName of Object.keys(plugin.services ?? {})) {\n if (seenServiceNames.has(serviceName)) {\n diagnostics.push(\n this.addDiagnostic({\n code: \"SERVICE_COLLISION\",\n severity: \"error\",\n message: `Duplicate service \"${serviceName}\" inside plugin ${plugin.name}`,\n pluginName: plugin.name,\n conflictingPluginName: plugin.name,\n key: serviceName,\n }),\n );\n continue;\n }\n\n seenServiceNames.add(serviceName);\n const existingServiceOwner = this.serviceOwners.get(serviceName);\n if (existingServiceOwner && existingServiceOwner !== plugin.name) {\n diagnostics.push(\n this.addDiagnostic({\n code: \"SERVICE_COLLISION\",\n severity: \"error\",\n message:\n `Service \"${serviceName}\" from plugin ${plugin.name} ` +\n `conflicts with plugin ${existingServiceOwner}`,\n pluginName: plugin.name,\n conflictingPluginName: existingServiceOwner,\n key: serviceName,\n }),\n );\n }\n }\n\n return diagnostics;\n }\n\n private addDiagnostic(\n diagnostic: Omit<PluginRegistryDiagnostic, \"timestamp\">,\n ): PluginRegistryDiagnostic {\n const fullDiagnostic: PluginRegistryDiagnostic = {\n ...diagnostic,\n timestamp: new Date().toISOString(),\n };\n this.diagnostics.push(fullDiagnostic);\n return fullDiagnostic;\n }\n\n /**\n * Merge flat menu items into a grouped tree:\n * Module → (optional) Category → Items\n *\n * Items without a `module` are placed under \"Other\".\n */\n private mergeMenus(items: MenuItem[]): MenuItem[] {\n const moduleMap = new Map<string, MenuItem>();\n\n for (const item of items) {\n const moduleName = item.module || \"Other\";\n\n if (!moduleMap.has(moduleName)) {\n moduleMap.set(moduleName, {\n name: moduleName.toLowerCase(),\n label: moduleName,\n route: `/${moduleName.toLowerCase()}`,\n icon: this.getModuleIcon(moduleName),\n order: item.order,\n children: [],\n });\n }\n\n const moduleGroup = moduleMap.get(moduleName)!;\n\n // Track lowest order value for module-level sorting\n if (item.order !== undefined) {\n if (moduleGroup.order === undefined || item.order < moduleGroup.order) {\n moduleGroup.order = item.order;\n }\n }\n\n if (item.category) {\n // Find or create category sub-group\n let categoryGroup = moduleGroup.children?.find(\n c => c.label === item.category,\n );\n\n if (!categoryGroup) {\n categoryGroup = {\n name: item.category.toLowerCase(),\n label: item.category,\n route: `/${moduleName.toLowerCase()}/${item.category.toLowerCase()}`,\n children: [],\n };\n moduleGroup.children!.push(categoryGroup);\n }\n\n categoryGroup.children!.push(item);\n } else {\n // No category — add directly to module\n moduleGroup.children!.push(item);\n }\n }\n\n // Sort module groups by order (lower first, undefined last)\n return Array.from(moduleMap.values()).sort(\n (a, b) => (a.order ?? 999) - (b.order ?? 999),\n );\n }\n\n private getModuleIcon(moduleName: string): string {\n return MODULE_ICONS[moduleName] || MODULE_ICONS.Other;\n }\n\n private rebuildIndexesAndServices(): void {\n this.routeOwners.clear();\n this.menuNameOwners.clear();\n this.menuRouteOwners.clear();\n this.serviceOwners.clear();\n this.serviceContainer.clear();\n\n for (const plugin of this.plugins.values()) {\n this.registerPluginServices(plugin);\n this.registerPluginRoutes(plugin);\n this.registerPluginMenuItems(plugin);\n }\n }\n\n private registerPluginServices(plugin: FrameworkMPlugin): void {\n for (const [name, factory] of Object.entries(plugin.services ?? {})) {\n this.serviceContainer.register(name, factory);\n this.serviceOwners.set(name, plugin.name);\n }\n }\n\n private registerPluginRoutes(plugin: FrameworkMPlugin): void {\n for (const route of plugin.routes ?? []) {\n this.routeOwners.set(route.path, plugin.name);\n }\n }\n\n private registerPluginMenuItems(plugin: FrameworkMPlugin): void {\n for (const item of plugin.menu ?? []) {\n this.menuNameOwners.set(item.name, plugin.name);\n this.menuRouteOwners.set(item.route, plugin.name);\n }\n }\n\n private emit<E extends PluginRegistryEvent>(\n event: E,\n payload: PluginRegistryEventPayloadMap[E],\n ): void {\n for (const handler of this.eventListeners[event]) {\n handler(payload as never);\n }\n }\n}\n","/**\n * PluginRegistryContext — React context for the PluginRegistry.\n *\n * Provides the PluginRegistry to all child components via React Context.\n * Must wrap any component that uses usePluginMenu(), usePlugin(), or useService().\n */\n\nimport { createContext, useEffect, useState, type ReactNode } from \"react\";\nimport { PluginRegistry } from \"../core/PluginRegistry\";\n\nexport const PluginRegistryContext = createContext<PluginRegistry | null>(null);\n\nexport interface PluginRegistryProviderProps {\n readonly children: ReactNode;\n /** Optional pre-configured PluginRegistry instance */\n readonly registry?: PluginRegistry;\n}\n\n/**\n * Provider component that makes the PluginRegistry available to child components.\n *\n * @example\n * ```tsx\n * const registry = new PluginRegistry();\n * await registry.register(wmsPlugin);\n *\n * <PluginRegistryProvider registry={registry}>\n * <App />\n * </PluginRegistryProvider>\n * ```\n */\nexport function PluginRegistryProvider({\n children,\n registry,\n}: PluginRegistryProviderProps) {\n const [registryInstance] = useState<PluginRegistry>(\n () => registry ?? new PluginRegistry(),\n );\n const [isReady, setIsReady] = useState(false);\n\n useEffect(() => {\n setIsReady(true);\n }, []);\n\n if (!isReady) {\n return null;\n }\n\n return (\n <PluginRegistryContext.Provider value={registryInstance}>\n {children}\n </PluginRegistryContext.Provider>\n );\n}\n","/**\n * usePluginMenu — React hook for accessing the merged menu tree.\n *\n * Returns the merged MenuItem[] from all registered plugins.\n * Must be used within a PluginRegistryProvider.\n *\n * @example\n * ```tsx\n * function Sidebar() {\n * const menu = usePluginMenu();\n * return <nav>{menu.map(m => <ModuleGroup key={m.name} {...m} />)}</nav>;\n * }\n * ```\n */\n\nimport { useContext, useEffect, useState } from \"react\";\nimport { PluginRegistryContext } from \"../context/PluginRegistryContext\";\nimport type { MenuItem } from \"../types/plugin\";\n\nasync function filterMenuByPermissions(\n items: MenuItem[],\n checker: (permissions: string[]) => boolean | Promise<boolean>,\n): Promise<MenuItem[]> {\n const filtered: MenuItem[] = [];\n\n for (const item of items) {\n if (item.hidden) {\n continue;\n }\n\n if (item.permissions && item.permissions.length > 0) {\n const allowed = await Promise.resolve(checker(item.permissions));\n if (!allowed) {\n continue;\n }\n }\n\n const children = item.children\n ? await filterMenuByPermissions(item.children, checker)\n : undefined;\n\n if (item.children && (children?.length ?? 0) === 0) {\n continue;\n }\n\n filtered.push({ ...item, children });\n }\n\n return filtered;\n}\n\nexport function usePluginMenu(): MenuItem[] {\n const registry = useContext(PluginRegistryContext);\n const [menu, setMenu] = useState<MenuItem[]>([]);\n\n if (!registry) {\n throw new Error(\"usePluginMenu must be used within PluginRegistryProvider\");\n }\n\n useEffect(() => {\n let cancelled = false;\n\n const load = async () => {\n const source = registry.getMenu();\n const checker = registry.getPermissionChecker();\n\n if (!checker) {\n if (!cancelled) {\n setMenu(source.filter(item => !item.hidden));\n }\n return;\n }\n\n const filtered = await filterMenuByPermissions(source, checker);\n if (!cancelled) {\n setMenu(filtered);\n }\n };\n\n void load();\n\n return () => {\n cancelled = true;\n };\n }, [registry]);\n\n return menu;\n}\n","/**\n * usePlugin — React hook for accessing a specific plugin by name.\n *\n * Returns the FrameworkMPlugin or undefined if not found.\n * Must be used within a PluginRegistryProvider.\n *\n * @example\n * ```tsx\n * function WMSStatus() {\n * const wms = usePlugin(\"wms\");\n * if (!wms) return <p>WMS not installed</p>;\n * return <p>WMS v{wms.version}</p>;\n * }\n * ```\n */\n\nimport { useContext, useMemo } from \"react\";\nimport { PluginRegistryContext } from \"../context/PluginRegistryContext\";\nimport type { FrameworkMPlugin } from \"../types/plugin\";\n\nexport function usePlugin(name: string): FrameworkMPlugin | undefined {\n const registry = useContext(PluginRegistryContext);\n\n if (!registry) {\n throw new Error(\"usePlugin must be used within PluginRegistryProvider\");\n }\n\n return useMemo(() => registry.getPlugin(name), [registry, name]);\n}\n","/**\n * useService — React hook for accessing a service from the ServiceContainer.\n *\n * Returns the service instance (lazily loaded), loading state, and error.\n * Must be used within a PluginRegistryProvider.\n *\n * @example\n * ```tsx\n * function WarehouseDashboard() {\n * const { service, isLoading, error } = useService<WarehouseService>(\"warehouseService\");\n * if (isLoading) return <Spinner />;\n * if (error) return <Error message={error.message} />;\n * return <div>{service.getWarehouses()}</div>;\n * }\n * ```\n */\n\nimport { useContext, useEffect, useMemo, useState } from \"react\";\nimport { PluginRegistryContext } from \"../context/PluginRegistryContext\";\n\ninterface UseServiceResult<T> {\n service: T | null;\n isLoading: boolean;\n error: Error | null;\n}\n\nexport function useService<T = unknown>(name: string): UseServiceResult<T> {\n const registry = useContext(PluginRegistryContext);\n\n if (!registry) {\n throw new Error(\"useService must be used within PluginRegistryProvider\");\n }\n\n const [service, setService] = useState<T | null>(null);\n const [isLoading, setIsLoading] = useState(true);\n const [error, setError] = useState<Error | null>(null);\n const servicePromise = useMemo(\n () => registry.getService<T>(name),\n [registry, name],\n );\n\n useEffect(() => {\n let cancelled = false;\n setIsLoading(true);\n setError(null);\n\n servicePromise\n .then(instance => {\n if (!cancelled) {\n setService(instance);\n setIsLoading(false);\n }\n })\n .catch((err: unknown) => {\n if (!cancelled) {\n setError(err instanceof Error ? err : new Error(String(err)));\n setIsLoading(false);\n }\n });\n\n return () => {\n cancelled = true;\n };\n }, [servicePromise]);\n\n return { service, isLoading, error };\n}\n","/**\n * useWidgets — React hook for accessing plugin-provided dashboard widgets.\n */\n\nimport { useContext, useEffect, useState } from \"react\";\nimport { PluginRegistryContext } from \"../context/PluginRegistryContext\";\nimport type { Widget } from \"../types/plugin\";\n\nasync function filterWidgetsByPermissions(\n widgets: Widget[],\n checker: (permissions: string[]) => boolean | Promise<boolean>,\n): Promise<Widget[]> {\n const filtered: Widget[] = [];\n\n for (const widget of widgets) {\n if (widget.permissions && widget.permissions.length > 0) {\n const allowed = await Promise.resolve(checker(widget.permissions));\n if (!allowed) {\n continue;\n }\n }\n\n filtered.push(widget);\n }\n\n return filtered;\n}\n\nexport function useWidgets(): Widget[] {\n const registry = useContext(PluginRegistryContext);\n const [widgets, setWidgets] = useState<Widget[]>([]);\n\n if (!registry) {\n throw new Error(\"useWidgets must be used within PluginRegistryProvider\");\n }\n\n useEffect(() => {\n let cancelled = false;\n\n const load = async () => {\n const source = registry.getWidgets();\n const checker = registry.getPermissionChecker();\n\n if (!checker) {\n if (!cancelled) {\n setWidgets(source);\n }\n return;\n }\n\n const filtered = await filterWidgetsByPermissions(source, checker);\n if (!cancelled) {\n setWidgets(filtered);\n }\n };\n\n void load();\n\n return () => {\n cancelled = true;\n };\n }, [registry]);\n\n return widgets;\n}\n"],"names":["ServiceContainer","__publicField","name","factory","instance","SDK_VERSION","MODULE_ICONS","isDebugEnabled","globalFlag","processRef","envFlag","registryLogger","message","args","PluginRegistry","plugin","diagnostics","errors","d","error","previous","warnings","allMenus","routes","pluginName","widgets","checker","event","handler","severity","reports","report","peerName","current","required","clean","cMajor","cMinor","cPatch","rMajor","rMinor","rPatch","seenRoutePaths","route","existingRouteOwner","seenMenuNames","seenMenuRoutes","item","existingNameOwner","seenServiceNames","serviceName","existingServiceOwner","diagnostic","fullDiagnostic","items","moduleMap","moduleName","moduleGroup","categoryGroup","_a","c","a","b","payload","PluginRegistryContext","createContext","PluginRegistryProvider","children","registry","registryInstance","useState","isReady","setIsReady","useEffect","filterMenuByPermissions","filtered","usePluginMenu","useContext","menu","setMenu","cancelled","source","usePlugin","useMemo","useService","service","setService","isLoading","setIsLoading","setError","servicePromise","err","filterWidgetsByPermissions","widget","useWidgets","setWidgets"],"mappings":";;;;;AAgBO,MAAMA,EAAiB;AAAA,EAAvB;AACY,IAAAC,EAAA,uCAAgB,IAAA;AAChB,IAAAA,EAAA,uCAAgB,IAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQjC,SAAYC,GAAcC,GAAkC;AAC1D,SAAK,UAAU,IAAID,GAAMC,CAAyB,GAElD,KAAK,UAAU,OAAOD,CAAI;AAAA,EAC5B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,MAAM,IAAiBA,GAA0B;AAE/C,QAAI,KAAK,UAAU,IAAIA,CAAI;AACzB,aAAO,KAAK,UAAU,IAAIA,CAAI;AAGhC,UAAMC,IAAU,KAAK,UA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EZ,EAAE,SAAAL,GAAS,WAAAE,GAAW,OAAApE,EAAA;AAC/B;AC1DA,eAAeyE,EACbnE,GACAC,GACmB;AACnB,QAAMiD,IAAqB,CAAA;AAE3B,aAAWkB,KAAUpE;AACnB,IAAIoE,EAAO,eAAeA,EAAO,YAAY,SAAS,KAEhD,CADY,MAAM,QAAQ,QAAQnE,EAAQmE,EAAO,WAAW,CAAC,KAMnElB,EAAS,KAAKkB,CAAM;AAGtB,SAAOlB;AACT;AAEO,SAASmB,IAAuB;AACrC,QAAM1B,IAAWS,EAAWb,CAAqB,GAC3C,CAACvC,GAASsE,CAAU,IAAIzB,EAAmB,CAAA,CAAE;AAEnD,MAAI,CAACF;AACH,UAAM,IAAI,MAAM,uDAAuD;AAGzE,SAAAK,EAAU,MAAM;AACd,QAAIO,IAAY;AAmBhB,YAjBa,YAAY;AACvB,YAAMC,IAASb,EAAS,WAAA,GAClB1C,IAAU0C,EAAS,qBAAA;AAEzB,UAAI,CAAC1C,GAAS;AACZ,QAAKsD,KACHe,EAAWd,CAAM;AAEnB;AAAA,MACF;AAEA,YAAMN,IAAW,MAAMiB,EAA2BX,GAAQvD,CAAO;AACjE,MAAKsD,KACHe,EAAWpB,CAAQ;AAAA,IAEvB,GAEK,GAEE,MAAM;AACX,MAAAK,IAAY;AAAA,IACd;AAAA,EACF,GAAG,CAACZ,CAAQ,CAAC,GAEN3C;AACT;"}
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import { ComponentType, LazyExoticComponent } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* A single menu item contributed by a plugin.
|
|
4
|
+
*
|
|
5
|
+
* Menu items are merged across all plugins by `module` and optionally
|
|
6
|
+
* grouped by `category` within each module.
|
|
7
|
+
*/
|
|
8
|
+
export interface MenuItem {
|
|
9
|
+
/** Unique identifier, e.g. "wms.warehouse" */
|
|
10
|
+
name: string;
|
|
11
|
+
/** Display label, e.g. "Warehouse" */
|
|
12
|
+
label: string;
|
|
13
|
+
/** Route path, e.g. "/doctypes/wms.warehouse" */
|
|
14
|
+
route: string;
|
|
15
|
+
/** Icon name (lucide-react icon key) */
|
|
16
|
+
icon?: string;
|
|
17
|
+
/** Module group, e.g. "Inventory" — used for sidebar grouping */
|
|
18
|
+
module?: string;
|
|
19
|
+
/** Category within module, e.g. "Masters", "Transactions" */
|
|
20
|
+
category?: string;
|
|
21
|
+
/** Sort order (lower = first). Default: 999 */
|
|
22
|
+
order?: number;
|
|
23
|
+
/** Nested child menu items */
|
|
24
|
+
children?: MenuItem[];
|
|
25
|
+
/** Optional visibility flag for menu composition */
|
|
26
|
+
hidden?: boolean;
|
|
27
|
+
/** Optional permission keys required to display this menu item */
|
|
28
|
+
permissions?: string[];
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* A route contributed by a plugin. Uses lazy loading for code-splitting.
|
|
32
|
+
*/
|
|
33
|
+
export interface RouteDefinition {
|
|
34
|
+
/** URL path, e.g. "/wms/dashboard" */
|
|
35
|
+
path: string;
|
|
36
|
+
/** Lazy-loaded component */
|
|
37
|
+
element: LazyExoticComponent<ComponentType> | (() => Promise<{
|
|
38
|
+
default: ComponentType;
|
|
39
|
+
}>);
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Factory function for creating a service instance.
|
|
43
|
+
* Can be sync or async (e.g. dynamic import).
|
|
44
|
+
*/
|
|
45
|
+
export type ServiceFactory<T = unknown> = () => T | Promise<T>;
|
|
46
|
+
/**
|
|
47
|
+
* Checks whether a user is allowed to access an item guarded by permissions.
|
|
48
|
+
*/
|
|
49
|
+
export type PermissionChecker = (permissions: string[]) => boolean | Promise<boolean>;
|
|
50
|
+
/**
|
|
51
|
+
* Optional React provider contribution from a plugin.
|
|
52
|
+
*/
|
|
53
|
+
export interface Provider {
|
|
54
|
+
component: () => Promise<{
|
|
55
|
+
default: ComponentType;
|
|
56
|
+
}>;
|
|
57
|
+
props?: Record<string, unknown>;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Optional DocType extension contribution from a plugin.
|
|
61
|
+
*/
|
|
62
|
+
export interface DocTypeExtension {
|
|
63
|
+
doctype: string;
|
|
64
|
+
fields?: Record<string, unknown>;
|
|
65
|
+
actions?: Array<Record<string, unknown>>;
|
|
66
|
+
components?: Record<string, ComponentType>;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Optional dashboard widget contribution from a plugin.
|
|
70
|
+
*/
|
|
71
|
+
export interface Widget {
|
|
72
|
+
id: string;
|
|
73
|
+
title: string;
|
|
74
|
+
component: () => Promise<{
|
|
75
|
+
default: ComponentType;
|
|
76
|
+
}>;
|
|
77
|
+
size?: "small" | "medium" | "large";
|
|
78
|
+
permissions?: string[];
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* The main plugin contract. Every Framework M plugin must satisfy this interface.
|
|
82
|
+
*
|
|
83
|
+
* @example
|
|
84
|
+
* ```ts
|
|
85
|
+
* // apps/wms/frontend/plugin.config.ts
|
|
86
|
+
* export default {
|
|
87
|
+
* name: "wms",
|
|
88
|
+
* version: "1.0.0",
|
|
89
|
+
* menu: [
|
|
90
|
+
* { name: "wms.warehouse", label: "Warehouse", route: "/doctypes/wms.warehouse", module: "Inventory" },
|
|
91
|
+
* ],
|
|
92
|
+
* } satisfies FrameworkMPlugin;
|
|
93
|
+
* ```
|
|
94
|
+
*/
|
|
95
|
+
export interface FrameworkMPlugin {
|
|
96
|
+
/** Unique plugin name */
|
|
97
|
+
name: string;
|
|
98
|
+
/** Semver version */
|
|
99
|
+
version: string;
|
|
100
|
+
/** Minimum SDK version required (semver range, e.g. ">=0.1.0") */
|
|
101
|
+
minSdkVersion?: string;
|
|
102
|
+
/** Other plugins this plugin depends on */
|
|
103
|
+
peerPlugins?: string[];
|
|
104
|
+
/** Menu items contributed by this plugin */
|
|
105
|
+
menu?: MenuItem[];
|
|
106
|
+
/** Routes contributed by this plugin */
|
|
107
|
+
routes?: RouteDefinition[];
|
|
108
|
+
/** Named service factories for DI */
|
|
109
|
+
services?: Record<string, ServiceFactory>;
|
|
110
|
+
/** Optional provider contributions */
|
|
111
|
+
providers?: Provider[];
|
|
112
|
+
/** Optional DocType extension contributions */
|
|
113
|
+
doctypes?: DocTypeExtension[];
|
|
114
|
+
/** Optional dashboard widget contributions */
|
|
115
|
+
widgets?: Widget[];
|
|
116
|
+
/** Optional initialization lifecycle hook */
|
|
117
|
+
onInit?: () => Promise<void> | void;
|
|
118
|
+
/** Optional cleanup lifecycle hook */
|
|
119
|
+
onDestroy?: () => Promise<void> | void;
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Result of checking a plugin's compatibility with the current SDK.
|
|
123
|
+
*/
|
|
124
|
+
export interface CompatibilityReport {
|
|
125
|
+
/** Plugin name */
|
|
126
|
+
name: string;
|
|
127
|
+
/** Plugin version */
|
|
128
|
+
version: string;
|
|
129
|
+
/** Whether the plugin is compatible with the current SDK version */
|
|
130
|
+
sdkCompatible: boolean;
|
|
131
|
+
/** Peer plugins that are required but not registered */
|
|
132
|
+
missingPeerPlugins: string[];
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Severity level for plugin registry diagnostics.
|
|
136
|
+
*/
|
|
137
|
+
export type PluginRegistryDiagnosticSeverity = "info" | "warning" | "error";
|
|
138
|
+
/**
|
|
139
|
+
* Structured diagnostic emitted by PluginRegistry during registration.
|
|
140
|
+
*/
|
|
141
|
+
export interface PluginRegistryDiagnostic {
|
|
142
|
+
/** Machine-readable diagnostic code */
|
|
143
|
+
code: "SDK_INCOMPATIBLE" | "PLUGIN_DUPLICATE" | "ROUTE_COLLISION" | "MENU_NAME_COLLISION" | "MENU_ROUTE_COLLISION" | "SERVICE_COLLISION";
|
|
144
|
+
/** Diagnostic severity */
|
|
145
|
+
severity: PluginRegistryDiagnosticSeverity;
|
|
146
|
+
/** Human-readable message */
|
|
147
|
+
message: string;
|
|
148
|
+
/** Plugin that triggered the diagnostic */
|
|
149
|
+
pluginName: string;
|
|
150
|
+
/** Optional key involved in the diagnostic (route path, service name, etc.) */
|
|
151
|
+
key?: string;
|
|
152
|
+
/** Existing plugin that conflicts with pluginName */
|
|
153
|
+
conflictingPluginName?: string;
|
|
154
|
+
/** ISO timestamp when generated */
|
|
155
|
+
timestamp: string;
|
|
156
|
+
}
|
|
157
|
+
//# sourceMappingURL=plugin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../src/types/plugin.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,OAAO,CAAC;AAMhE;;;;;GAKG;AACH,MAAM,WAAW,QAAQ;IACvB,8CAA8C;IAC9C,IAAI,EAAE,MAAM,CAAC;IACb,sCAAsC;IACtC,KAAK,EAAE,MAAM,CAAC;IACd,iDAAiD;IACjD,KAAK,EAAE,MAAM,CAAC;IACd,wCAAwC;IACxC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,iEAAiE;IACjE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,6DAA6D;IAC7D,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,+CAA+C;IAC/C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,8BAA8B;IAC9B,QAAQ,CAAC,EAAE,QAAQ,EAAE,CAAC;IACtB,oDAAoD;IACpD,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,kEAAkE;IAClE,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;CACxB;AAMD;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,sCAAsC;IACtC,IAAI,EAAE,MAAM,CAAC;IACb,4BAA4B;IAC5B,OAAO,EACH,mBAAmB,CAAC,aAAa,CAAC,GAClC,CAAC,MAAM,OAAO,CAAC;QAAE,OAAO,EAAE,aAAa,CAAA;KAAE,CAAC,CAAC,CAAC;CACjD;AAMD;;;GAGG;AACH,MAAM,MAAM,cAAc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ACrD,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,mCAAmC;IACnC,SAAS,EAAE,MAAM,CAAC;CACnB"}
|
package/package.json
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@framework-m/plugin-sdk",
|
|
3
|
+
"version": "0.2.3",
|
|
4
|
+
"description": "Plugin infrastructure and runtime for Framework M multi-app composition",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.cjs",
|
|
7
|
+
"module": "./dist/index.js",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"import": "./dist/index.js",
|
|
13
|
+
"require": "./dist/index.cjs"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"dist",
|
|
18
|
+
"README.md"
|
|
19
|
+
],
|
|
20
|
+
"keywords": [
|
|
21
|
+
"framework-m",
|
|
22
|
+
"plugin",
|
|
23
|
+
"sdk",
|
|
24
|
+
"plugin-system",
|
|
25
|
+
"multi-app"
|
|
26
|
+
],
|
|
27
|
+
"author": "Framework M Team",
|
|
28
|
+
"license": "Apache-2.0",
|
|
29
|
+
"repository": {
|
|
30
|
+
"type": "git",
|
|
31
|
+
"url": "https://gitlab.com/castlecraft/framework-m.git",
|
|
32
|
+
"directory": "libs/framework-m-plugin-sdk"
|
|
33
|
+
},
|
|
34
|
+
"peerDependencies": {
|
|
35
|
+
"@framework-m/desk": "^0.1.0",
|
|
36
|
+
"react": "^19.0.0"
|
|
37
|
+
},
|
|
38
|
+
"dependencies": {
|
|
39
|
+
"react-router-dom": "^7.0.0"
|
|
40
|
+
},
|
|
41
|
+
"devDependencies": {
|
|
42
|
+
"@testing-library/react": "^16.3.2",
|
|
43
|
+
"@types/react": "^19.2.14",
|
|
44
|
+
"@vitejs/plugin-react": "^4.7.0",
|
|
45
|
+
"happy-dom": "^20.8.4",
|
|
46
|
+
"react": "^19.2.4",
|
|
47
|
+
"react-dom": "^19.2.4",
|
|
48
|
+
"typescript": "^5.9.3",
|
|
49
|
+
"vite": "^6.4.1",
|
|
50
|
+
"vite-plugin-dts": "^4.5.1",
|
|
51
|
+
"vitest": "^4.1.0"
|
|
52
|
+
},
|
|
53
|
+
"publishConfig": {
|
|
54
|
+
"access": "public"
|
|
55
|
+
},
|
|
56
|
+
"scripts": {
|
|
57
|
+
"build": "tsc && vite build",
|
|
58
|
+
"dev": "vite build --watch",
|
|
59
|
+
"type-check": "tsc --noEmit",
|
|
60
|
+
"test": "vitest run",
|
|
61
|
+
"test:watch": "vitest",
|
|
62
|
+
"test:coverage": "vitest run --coverage"
|
|
63
|
+
}
|
|
64
|
+
}
|