Skip to content

Support custom clone operation #10

Open
@pokey

Description

@pokey

I'm trying to update a yaml file while preserving comments, using the yaml npm library. In order to preserve comments, I need the parsed file to be a yaml.Document, but that cannot be cloned using the default clone method provided by meta-updater. It would be great if custom formats supported an optional clone field that I could use to provide my own cloning methodology (I'd just use Document.clone).

I would be happy to contribute a PR

Fwiw, the error I get today is as follows:

DOMException [DataCloneError]: (value) => value instanceof Uint8Array could not be cloned.
    at new DOMException (node:internal/per_context/domexception:53:5)
    at structuredClone (node:internal/structured_clone:23:17)
    at performUpdates (file:///Users/pokey/src/cursorless/node_modules/.pnpm/@[email protected][email protected]/node_modules/@pnpm/meta-updater/lib/index.js:51:56)
    at async default (file:///Users/pokey/src/cursorless/node_modules/.pnpm/@[email protected][email protected]/node_modules/@pnpm/meta-updater/lib/index.js:16:20)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions