fix: break circular dependency in config error utilities to prevent plugin loader crash
- Created src/shared/config-errors.ts to isolate config error state management - Removed function re-exports (getConfigLoadErrors, clearConfigLoadErrors) from main index.ts - Only ConfigLoadError type is re-exported from main module to avoid OpenCode calling it as a plugin - Updated auto-update-checker hook to import from shared/config-errors instead of main index - Fixes "TypeError: undefined is not an object" crash when OpenCode iterated through ALL exports and called clearConfigLoadErrors(input) which returned undefined 🤖 GENERATED WITH ASSISTANCE OF [OhMyOpenCode](https://github.com/code-yeongyu/oh-my-opencode)
This commit is contained in:
18
src/shared/config-errors.ts
Normal file
18
src/shared/config-errors.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
export type ConfigLoadError = {
|
||||
path: string
|
||||
error: string
|
||||
}
|
||||
|
||||
let configLoadErrors: ConfigLoadError[] = []
|
||||
|
||||
export function getConfigLoadErrors(): ConfigLoadError[] {
|
||||
return configLoadErrors
|
||||
}
|
||||
|
||||
export function clearConfigLoadErrors(): void {
|
||||
configLoadErrors = []
|
||||
}
|
||||
|
||||
export function addConfigLoadError(error: ConfigLoadError): void {
|
||||
configLoadErrors.push(error)
|
||||
}
|
||||
@@ -11,3 +11,4 @@ export * from "./deep-merge"
|
||||
export * from "./file-utils"
|
||||
export * from "./dynamic-truncator"
|
||||
export * from "./config-path"
|
||||
export * from "./config-errors"
|
||||
|
||||
Reference in New Issue
Block a user