mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-06 12:54:20 +01:00
Replace strip-json-comments with jsonc-parser for better error reporting
This commit is contained in:
1 parent
e1890d0554
commit
e1a4a70d3d
13 files changed
+132
-34
No files matched your search
@@ -1,12 +1,4 @@
|
||||
import stripJsonComments from 'strip-json-comments'
|
||||
|
||||
export function parseJsonc<T = unknown>(content: string): T {
|
||||
try {
|
||||
return JSON.parse(stripJsonComments(content)) as T
|
||||
} catch (e) {
|
||||
throw new Error(`Failed to parse JSONC: ${e instanceof Error ? e.message : String(e)}`)
|
||||
}
|
||||
}
|
||||
export { parseJsonc } from '@opencode-manager/shared/utils'
|
||||
|
||||
export function hasJsoncComments(content: string): boolean {
|
||||
return content.split('\n').some(line => {
|
||||
|
||||
Reference in new issue
Block a user