v-transform 2.2.2 → 2.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/dump.js +2 -2
- package/src/loader.js +2 -2
- package/src/parser.js +2 -2
package/package.json
CHANGED
package/src/dump.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { dump as dumpYAML } from 'js-yaml'
|
|
2
2
|
import path from 'node:path'
|
|
3
3
|
import { writeFile, stat, mkdir } from 'node:fs/promises'
|
|
4
4
|
|
|
@@ -15,7 +15,7 @@ function esmify(data, space) {
|
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
function yamlify(data, space) {
|
|
18
|
-
return
|
|
18
|
+
return dumpYAML(data, {
|
|
19
19
|
indent: space || undefined,
|
|
20
20
|
})
|
|
21
21
|
}
|
package/src/loader.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { glob } from 'glob'
|
|
2
|
-
import
|
|
2
|
+
import { load as loadYAML } from 'js-yaml'
|
|
3
3
|
import path from 'node:path'
|
|
4
4
|
import { readFile } from 'node:fs/promises'
|
|
5
5
|
|
|
@@ -51,7 +51,7 @@ async function loadConfig(config) {
|
|
|
51
51
|
case '.json':
|
|
52
52
|
case '.yaml':
|
|
53
53
|
case '.yml':
|
|
54
|
-
return
|
|
54
|
+
return loadYAML(await readFile(config))
|
|
55
55
|
case '.js':
|
|
56
56
|
case '.mjs':
|
|
57
57
|
return (await import(config)).default
|
package/src/parser.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { load } from 'js-yaml'
|
|
2
2
|
|
|
3
3
|
function isCommentKey(key) {
|
|
4
4
|
return key.startsWith('#')
|
|
@@ -88,7 +88,7 @@ function formatRow({ type, key, source, subs }, row, original, json) {
|
|
|
88
88
|
|
|
89
89
|
function formatValue(key, source, value, json) {
|
|
90
90
|
if (value == null) return null
|
|
91
|
-
if (json.includes(source)) value =
|
|
91
|
+
if (json.includes(source)) value = load(value)
|
|
92
92
|
return { key, value }
|
|
93
93
|
}
|
|
94
94
|
|