Closed hirasso closed 10 months ago
@daun ready for review :)
API looks great! Is there an alternative for structuredClone
that has been supported for a little longer? When creating sites with a two-year browser support window, it will require a polyfill that adds a few kilobytes. Or maybe the plugin could check if structuredClone
is supported and only use it if found, otherwise do a shallow copy?
Hmm, right... I think I'll go with a detection for structuredClone and otherwise return a shallow copy, combined with a warning if options.debug
is true
...turns out cloning the rules by myself wasn't so hard, as it's structure is well known. structuredClone
dependency is gone!
Description
On large websites or in complex cases it could come in handy to be able to modify fragment rules on the fly. This PR is adding a few new API functions:
Questions
Is structuredClone ready to be used?
Checks
master
branchnpm run lint
)npm run test
)