Many of the previously unsupported web APIs are actually not possible to clone in JavaScript. In the end, only four of them can be cloned at all:
AudioData
ImageBitmap
ImageData
VideoFrame
The following objects can only be created with APIs that are not capable of meaningfully cloning the data:
CropTarget
The CropTarget has a class with a static method that takes an HTML DOM Element as an argument and returns a CropTarget for that HTML element. This is the only way to create a CropTarget. A CropTarget instance's association with an HTML element is stored in an internal slot and is not exposed in any way.
CryptoKey
The functions available in the global namespace which create CryptoKey are guaranteed to return an object representing a newly created CryptoKey (it is illegal to use the class constructor to create a CryptoKey). In this way, CryptoKey instances are analogous to symbols. Hence they cannot be meaningfully cloned by these factories.
FileSystemDirectoryHandle
The "FileSystem<>Handle" API is only capable of discerning information about subfiles/subdirectories of the file/directory represented by that class. While the classes has methods which can create new "FileSystem<>Handle" objects representing the subfiles/subdirectories, the web specification for them explicitly forbids any arguments to these methods that would resolve to the same file. They MUST return a subfile/subdirectory.
I noticed that DataTransferItem has a method for getting an item as a FileSystem<>Handle, so I wondered if it were possible to add a FileSystem<>Handle to a DataTransfer items list, retrieve the item, and then resolve it into a FileSystem<>Handle. For some reason, this did not work, and I could only retrieve the files as File objects.
FileSystemFileHandle
See comment above.
GPUCompilationInfo
There is a convoluted series of steps to get this object, and the resultant object does not expose any information regarding the shader that the object is associated with. Hence we cannot know how the object was created from merely observing its instance.
GPUCompilationMessage
The comment above also applies to this object.
RTCCertificate
The reasons CryptoKey cannot be cloned are essentially the same as for this object.
The four which can be cloned are now cloned. They each use the new pendingResults array.
I also performed miscellaneous code cleanup:
The logic for error handling the return value of customizers and cloning methods is much more readable now (no more evil nesting).
TypedArray subclasses, DataView, ArrayBuffer, Symbol, BigInt, Promise, Map and Set were all being accessed at top level in the module. They are now safely accessed with strings like Web APIs. This will make it possible to transpile this code for ES5-only environment if I decide to in the future.
I moved getTag into its own file in clone-deep/clone-deep-utils.
Many of the previously unsupported web APIs are actually not possible to clone in JavaScript. In the end, only four of them can be cloned at all:
The following objects can only be created with APIs that are not capable of meaningfully cloning the data:
The four which can be cloned are now cloned. They each use the new pendingResults array.
I also performed miscellaneous code cleanup: