|
1 | 1 | import { extname } from 'path';
|
2 | 2 | import { parse as parseTOML, stringify as stringifyTOML } from '@iarna/toml';
|
3 | 3 | import { safeLoad as parseYAML, safeDump as stringifyYAML } from 'js-yaml';
|
4 |
| -import { parse as parseJSON5, stringify as stringifyJSON5 } from 'json5'; |
| 4 | +import JSON5 from 'json5'; |
5 | 5 | import { Json, JsonObject } from '@app-config/utils';
|
6 | 6 | import { logger } from '@app-config/logging';
|
7 | 7 | import { ParsedValue, ParsingContext, ParsingExtension } from './parsed-value';
|
@@ -197,7 +197,7 @@ export function stringify(config: Json, fileType: FileType, minimal: boolean = f
|
197 | 197 | case FileType.JSON:
|
198 | 198 | return JSON.stringify(config, null, minimal ? 0 : 2);
|
199 | 199 | case FileType.JSON5:
|
200 |
| - return stringifyJSON5(config, null, minimal ? 0 : 2); |
| 200 | + return JSON5.stringify(config, null, minimal ? 0 : 2); |
201 | 201 | case FileType.TOML:
|
202 | 202 | return stringifyTOML(config as any);
|
203 | 203 | case FileType.YAML:
|
@@ -247,7 +247,7 @@ export async function parseRawString(contents: string, fileType: FileType): Prom
|
247 | 247 | case FileType.TOML:
|
248 | 248 | return parseTOML(contents) as JsonObject;
|
249 | 249 | case FileType.JSON5:
|
250 |
| - return parseJSON5(contents); |
| 250 | + return JSON5.parse(contents); |
251 | 251 | default:
|
252 | 252 | throw new BadFileType(`Unsupported FileType '${fileType as string}'`);
|
253 | 253 | }
|
|
0 commit comments