Refactor package.json and pnpm-lock.yaml to add rfdc dependency

This commit is contained in:
kwaroran
2024-10-26 19:58:52 +09:00
parent e255199fcc
commit 18d8bb7bab
3 changed files with 15 additions and 2 deletions

View File

@@ -2,16 +2,20 @@ import { ReadableStream, WritableStream, TransformStream } from "web-streams-pol
import { Buffer as BufferPolyfill } from 'buffer'
import { polyfill as dragPolyfill} from "mobile-drag-drop"
import {scrollBehaviourDragImageTranslateOverride} from 'mobile-drag-drop/scroll-behaviour'
import rfdc from 'rfdc'
/**
* Safe variant of structuredClone for svelte 5 states
* if structuredClone is not available, it will use JSON.parse(JSON.stringify(data)) instead
*/
const rfdcClone = rfdc({
circles:false,
})
function safeStructuredClone<T>(data:T):T{
try {
return structuredClone(data)
} catch (error) {
return JSON.parse(JSON.stringify(data))
return rfdcClone(data)
}
}