Skip to content

Commit abd88e6

Browse files
committed
fix: use correct json5 import
1 parent 4ca6e7b commit abd88e6

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

app-config-core/src/config-source.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { extname } from 'path';
22
import { parse as parseTOML, stringify as stringifyTOML } from '@iarna/toml';
33
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';
55
import { Json, JsonObject } from '@app-config/utils';
66
import { logger } from '@app-config/logging';
77
import { ParsedValue, ParsingContext, ParsingExtension } from './parsed-value';
@@ -197,7 +197,7 @@ export function stringify(config: Json, fileType: FileType, minimal: boolean = f
197197
case FileType.JSON:
198198
return JSON.stringify(config, null, minimal ? 0 : 2);
199199
case FileType.JSON5:
200-
return stringifyJSON5(config, null, minimal ? 0 : 2);
200+
return JSON5.stringify(config, null, minimal ? 0 : 2);
201201
case FileType.TOML:
202202
return stringifyTOML(config as any);
203203
case FileType.YAML:
@@ -247,7 +247,7 @@ export async function parseRawString(contents: string, fileType: FileType): Prom
247247
case FileType.TOML:
248248
return parseTOML(contents) as JsonObject;
249249
case FileType.JSON5:
250-
return parseJSON5(contents);
250+
return JSON5.parse(contents);
251251
default:
252252
throw new BadFileType(`Unsupported FileType '${fileType as string}'`);
253253
}

0 commit comments

Comments
 (0)