File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed
Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -256,11 +256,18 @@ function formatObject(obj) {
256256 let outputData = formatObjectKeys ( obj ) ;
257257
258258 // Other objects are formatted as YAML for human-readable output
259- let yamlString = yaml . safeDump ( outputData , {
259+ let yamlString = yaml . dump ( outputData , {
260260 indent : 4 ,
261261 noRefs : true ,
262262 } ) ;
263263
264+ // js-yaml 4.x changed its quoting behavior for certain strings.
265+ // For backward compatibility with js-yaml 3.x output:
266+ // 1. Quote URLs (http:// or https://)
267+ yamlString = yamlString . replaceAll ( / ^ ( \s * ) ( [ ^ : ] + ) : ( h t t p s ? : \/ \/ [ ^ \s ] + ) $ / gmu, "$1$2: '$3'" ) ;
268+ // 2. Unquote numeric strings starting with 0 (js-yaml 3.x didn't quote these)
269+ yamlString = yamlString . replaceAll ( / ^ ( \s * ) ( [ ^ : ] + ) : ' ( 0 \d + ) ' $ / gmu, '$1$2: $3' ) ;
270+
264271 // The YAML library puts a trailing newline at the end of the string, which is
265272 // redundant with the automatic newline added by oclif when writing to stdout
266273 return yamlString
You can’t perform that action at this time.
0 commit comments