🆕 Added support for JSON5

This commit is contained in:
duckietm
2026-05-18 16:14:38 +02:00
parent b6a26fbd84
commit 31df26bd1b
17 changed files with 494 additions and 281 deletions
@@ -1,4 +1,4 @@
import { NitroLogger, NitroVersion } from '@nitrots/utils';
import { NitroLogger, NitroVersion, parseConfigJsonFromResponse } from '@nitrots/utils';
import { IConfigurationManager } from './IConfigurationManager';
export class ConfigurationManager implements IConfigurationManager
@@ -54,11 +54,11 @@ export class ConfigurationManager implements IConfigurationManager
try
{
json = await response.json();
json = await parseConfigJsonFromResponse(response, url);
}
catch(parseError)
{
throw new Error(`Invalid JSON in config "${ url }" — check for syntax errors like trailing commas or missing quotes (${ parseError.message })`);
throw new Error(`Invalid config "${ url }" — JSON/JSON5 parse failed. JSON5 allows comments, trailing commas and unquoted keys (${ parseError.message })`);
}
this.parseConfiguration(json);