fix(yaml viewer): handle numbers as bigint to avoid conversion to exponent
This commit is contained in:
parent
e68f743147
commit
ab6609ef7b
1
src/tools/yaml-viewer/composeverter.d.ts
vendored
1
src/tools/yaml-viewer/composeverter.d.ts
vendored
@ -17,4 +17,5 @@ declare module 'composeverter' {
|
|||||||
export function migrateFromV2xToV3x(content: string, configuration?: Configuration = null): string;
|
export function migrateFromV2xToV3x(content: string, configuration?: Configuration = null): string;
|
||||||
export function getDockerComposeSchemaWithoutFormats(): object;
|
export function getDockerComposeSchemaWithoutFormats(): object;
|
||||||
export function yamlParse(content: string): object;
|
export function yamlParse(content: string): object;
|
||||||
|
export function yamlCheck(content: string): object;
|
||||||
}
|
}
|
||||||
@ -1,5 +1,5 @@
|
|||||||
import { type MaybeRef, get } from '@vueuse/core';
|
import { type MaybeRef, get } from '@vueuse/core';
|
||||||
import { yamlParse } from 'composeverter';
|
import { yamlCheck } from 'composeverter';
|
||||||
import yaml from 'yaml';
|
import yaml from 'yaml';
|
||||||
|
|
||||||
export { formatYaml };
|
export { formatYaml };
|
||||||
@ -13,7 +13,9 @@ function formatYaml({
|
|||||||
sortKeys?: MaybeRef<boolean>
|
sortKeys?: MaybeRef<boolean>
|
||||||
indentSize?: MaybeRef<number>
|
indentSize?: MaybeRef<number>
|
||||||
}) {
|
}) {
|
||||||
const parsedYaml = yamlParse(get(rawYaml));
|
const rawYamlString = get(rawYaml);
|
||||||
|
yamlCheck(rawYamlString);
|
||||||
|
const parsedYaml = yaml.parse(rawYamlString, { intAsBigInt: true });
|
||||||
|
|
||||||
const formattedYAML = yaml.stringify(parsedYaml, {
|
const formattedYAML = yaml.stringify(parsedYaml, {
|
||||||
sortMapEntries: get(sortKeys),
|
sortMapEntries: get(sortKeys),
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user