Using existing yaml package instead of js-yaml

This commit is contained in:
Isaiah 2023-11-29 14:04:10 -05:00
parent 5f92d640c9
commit 1e8dc931a9
4 changed files with 7 additions and 18 deletions

View file

@ -62,7 +62,6 @@
"highlight.js": "^11.7.0",
"iarna-toml-esm": "^3.0.5",
"ibantools": "^4.3.3",
"js-yaml": "^4.1.0",
"json5": "^2.2.3",
"jwt-decode": "^3.1.2",
"libphonenumber-js": "^1.10.28",
@ -102,7 +101,6 @@
"@types/bcryptjs": "^2.4.2",
"@types/crypto-js": "^4.1.1",
"@types/dompurify": "^3.0.5",
"@types/js-yaml": "^4.0.9",
"@types/jsdom": "^21.0.0",
"@types/lodash": "^4.14.192",
"@types/mime-types": "^2.1.1",

11
pnpm-lock.yaml generated
View file

@ -86,9 +86,6 @@ dependencies:
ibantools:
specifier: ^4.3.3
version: 4.3.3
js-yaml:
specifier: ^4.1.0
version: 4.1.0
json5:
specifier: ^2.2.3
version: 2.2.3
@ -202,9 +199,6 @@ devDependencies:
'@types/dompurify':
specifier: ^3.0.5
version: 3.0.5
'@types/js-yaml':
specifier: ^4.0.9
version: 4.0.9
'@types/jsdom':
specifier: ^21.0.0
version: 21.1.0
@ -2948,10 +2942,6 @@ packages:
'@types/node': 18.15.11
dev: true
/@types/js-yaml@4.0.9:
resolution: {integrity: sha512-k4MGaQl5TGo/iipqb2UDG2UwjXziSWkh0uysQelTlJpX1qGlpUZYm8PnO4DxG1qBomtJUdYJ6qR6xdIah10JLg==}
dev: true
/@types/jsdom@21.1.0:
resolution: {integrity: sha512-leWreJOdnuIxq9Y70tBVm/bvTuh31DSlF/r4l7Cfi4uhVQqLHD0Q4v301GMisEMwwbMgF7ZKxuZ+Jbd4NcdmRw==}
dependencies:
@ -6530,6 +6520,7 @@ packages:
hasBin: true
dependencies:
argparse: 2.0.1
dev: true
/jsbn@1.1.0:
resolution: {integrity: sha512-4bYVV3aAMtDTTu4+xsDYa6sy9GyJ69/amsu9sYF2zqjiEoZA5xJi3BrfX3uY+/IekIu7MwdObdbDWpoZdBv3/A==}

View file

@ -1,6 +1,6 @@
import { type MaybeRef, get } from '@vueuse/core';
import yaml from 'js-yaml';
import yaml from 'yaml';
export { formatYaml };
@ -13,10 +13,10 @@ function formatYaml({
sortKeys?: MaybeRef<boolean>
indentSize?: MaybeRef<number>
}) {
const parsedYaml = yaml.load(get(rawYaml));
const parsedYaml = yaml.parse(get(rawYaml));
const formattedYAML = yaml.dump(parsedYaml, {
sortKeys: get(sortKeys),
const formattedYAML = yaml.stringify(parsedYaml, {
sortMapEntries: get(sortKeys),
indent: get(indentSize),
});

View file

@ -1,5 +1,5 @@
<script setup lang="ts">
import yaml from 'js-yaml';
import yaml from 'yaml';
import { useStorage } from '@vueuse/core';
import { formatYaml } from './yaml-models';
import { withDefaultOnError } from '@/utils/defaults';
@ -18,7 +18,7 @@ const rawYamlValidation = useValidation({
source: rawYaml,
rules: [
{
validator: v => v === '' || yaml.load(v),
validator: v => v === '' || yaml.parse(v),
message: 'Provided YAML is not valid.',
},
],