pnpm / meta-updater

MIT License
54 stars 6 forks source link

Feat: Support custom clone operation #12

Open b0o opened 7 months ago

b0o commented 7 months ago

Adds an optional clone method to the FormatPlugin interface. This method is used to clone the object returned by read before passing it to update. This is useful when the object returned by read is not trivially cloneable.

One use case is when trying to preserve comments in a JSONC file using the comment-json package, which uses symbol properties on the object to store comments. The default clone method would not preserve these symbol properties, so a custom clone method is needed.

Fixes #10

b0o commented 6 months ago

Hey @zkochan, sorry to bother you, but I was wondering if you could take another look at this and let me know if I can do anything to improve it?