Open alexeagle opened 2 years ago
+1
@alexeagle I'm also interested in this topic. Do you know what's required to move it forward?
It would require buy-in from language spec as well as the three major implementations to commit to supporting it. @laurentlb might be able to provide guidance if you care enough about this to be the champion. If you just need basic yaml parsing, @kormide wrote a partial parser in starlark used in earlier rules_js releases.
For all the same reasons the
json
module was added to starlark. Note there's an implementation over here for the Go implementation of starlark https://github.com/qri-io/starlib/tree/master/encoding/yaml but I doubt that's useful in any way.The motivation is that the
pnpm
tool needs to be integrated as a repository rule, and the data needed to fetch packages in in yaml: https://pnpm.io/git#lockfilesAs a workaround we're using the
yq
toolchain to translate yaml to json, which starlark does know how to read: https://docs.aspect.build/aspect-build/bazel-lib/v0.9.6/docs/yq-docgen.html#yq however it's difficult in a Bazel repository rule to access a tool provided by a toolchain, and impossible under bzlmod (https://github.com/bazelbuild/bazel/issues/14445 - one module extension fetches ayq
binary but another module extension wants to run it)