-
-
Notifications
You must be signed in to change notification settings - Fork 113
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Proxy Interface for Document #294
Comments
That sounds like a really interesting idea, I'm definitely interested in seeing what your prototype might look like. While I had not considered a Proxy before, I had thought of optionally including some hidden fields (symbol-keyed, non-enumerable) in the |
I will report back with a repo link when I have something to show.
I'm betting you've seen this but if not it's worth a look: https://www.npmjs.com/package/comment-json |
I feel it is important to point out that there are still JS runtimes that do not support Proxy. To be more specific, Cloudflare workers don't support it. I currently use this library to convert JSON to YAML (and vice versa) in an API service running in a worker. I wish this weren't the case, because the Proxy pattern is a solid one.... but if this goes forward, consider the ramifications (perhaps a semver major change). |
@coreybutler good to raise this issue. Are you certain it's not supported in Cloudflare workers? Per their documentation on JavaScript:
None of the exceptions refer to Proxies are from ES6/ES2015, and |
@pskfyi - I'm actually very happy to be outdated on this matter. Their docs have always stated support for Anyhow, I'd be happy to test a Proxy-based implementation of this in Cloudflare Workers when it is available. |
As a clarification of my position, if a Proxy interface is added, it should probably first be added in parallel with the existing API, rather than replacing it. |
Understood, and I agree completely. |
The round trip for editing documents while preserving comments is understandably complex. It seems plausible to wrap
YAML.Document.Parsed
in a Proxy which can be read similarly to the results of.toJs()
(or.toJson()
), but setting properties on it uses methods like.setIn()
under the hood to keep the full document structure up-to-date.I intend to prototype this in the next few weeks and I wanted to see if the library would be interested in a feature like this, or perhaps if you've explored this and found some problem with the approach. If it seems plausible, I'd like to collaborate.
Cheers 🍻
The text was updated successfully, but these errors were encountered: