@visulima/deep-clone 2.1.2 → 2.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +46 -0
- package/README.md +0 -0
- package/dist/handler.cjs +1 -69
- package/dist/handler.d.cts +1 -1
- package/dist/handler.d.mts +33 -0
- package/dist/handler.d.ts +1 -1
- package/dist/handler.mjs +1 -0
- package/dist/index.cjs +1 -10
- package/dist/index.d.cts +2 -2
- package/dist/index.d.mts +9 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.mjs +1 -0
- package/dist/packem_shared/copyArrayBuffer-CErFt6r1.cjs +1 -0
- package/dist/packem_shared/copyArrayBuffer-hX6Bv2Yc.mjs +1 -0
- package/dist/packem_shared/copyArrayLoose-B2xEXxZi.mjs +1 -0
- package/dist/packem_shared/copyArrayLoose-ukX__AC4.cjs +1 -0
- package/dist/packem_shared/copyBlob-CCIQ88PB.cjs +1 -0
- package/dist/packem_shared/copyBlob-zWtjc8BU.mjs +1 -0
- package/dist/packem_shared/copyDataView-C9SuIdXo.cjs +1 -0
- package/dist/packem_shared/copyDataView-CHZxqd6h.mjs +1 -0
- package/dist/packem_shared/copyDate-CSebYDy0.mjs +1 -0
- package/dist/packem_shared/copyDate-CfZZ3WAO.cjs +1 -0
- package/dist/packem_shared/copyError-BzQAysGw.mjs +1 -0
- package/dist/packem_shared/copyError-DGbUXsSU.cjs +1 -0
- package/dist/packem_shared/copyMapLoose-CorlUnMI.mjs +1 -0
- package/dist/packem_shared/copyMapLoose-CuTK-fBO.cjs +1 -0
- package/dist/packem_shared/copyObjectLoose-CbVJDz5e.cjs +1 -0
- package/dist/packem_shared/copyObjectLoose-DrrTtApt.mjs +1 -0
- package/dist/packem_shared/copyOwnProperties-QEhjt2x8.mjs +1 -0
- package/dist/packem_shared/copyOwnProperties-Zk6Vg6Oe.cjs +1 -0
- package/dist/packem_shared/copyRegExpLoose-BvCnMoGQ.mjs +1 -0
- package/dist/packem_shared/copyRegExpLoose-DzJvEX_n.cjs +1 -0
- package/dist/packem_shared/copySetLoose-FGAEcE9e.mjs +1 -0
- package/dist/packem_shared/copySetLoose-v1Cjaq91.cjs +1 -0
- package/dist/packem_shared/getCleanClone-D0FN9QGR.mjs +1 -0
- package/dist/packem_shared/getCleanClone-DLZ_E9xd.cjs +1 -0
- package/dist/packem_shared/types-_Qve7nv8.d.mts +31 -0
- package/dist/utils.cjs +1 -16
- package/dist/utils.d.cts +1 -1
- package/dist/utils.d.mts +7 -0
- package/dist/utils.d.ts +1 -1
- package/dist/utils.mjs +1 -0
- package/package.json +197 -186
- package/dist/chunk-L5LW2LUR.js +0 -7
- package/dist/chunk-L5LW2LUR.js.map +0 -1
- package/dist/chunk-LPGIVFCB.js +0 -5
- package/dist/chunk-LPGIVFCB.js.map +0 -1
- package/dist/chunk-ULIBPEBE.cjs +0 -8
- package/dist/chunk-ULIBPEBE.cjs.map +0 -1
- package/dist/chunk-ZJWITT73.cjs +0 -23
- package/dist/chunk-ZJWITT73.cjs.map +0 -1
- package/dist/handler.cjs.map +0 -1
- package/dist/handler.js +0 -4
- package/dist/handler.js.map +0 -1
- package/dist/index.cjs.map +0 -1
- package/dist/index.js +0 -8
- package/dist/index.js.map +0 -1
- package/dist/utils.cjs.map +0 -1
- package/dist/utils.js +0 -3
- package/dist/utils.js.map +0 -1
- /package/dist/{types-P5vua37Z.d.cts → packem_shared/types-_Qve7nv8.d.cts} +0 -0
- /package/dist/{types-P5vua37Z.d.ts → packem_shared/types-_Qve7nv8.d.mjs} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,49 @@
|
|
|
1
|
+
## @visulima/deep-clone [2.1.4](https://github.com/visulima/visulima/compare/@visulima/deep-clone@2.1.3...@visulima/deep-clone@2.1.4) (2024-09-12)
|
|
2
|
+
|
|
3
|
+
### Bug Fixes
|
|
4
|
+
|
|
5
|
+
* **deep-clone:** moved from tsup to packem ([5b40fb9](https://github.com/visulima/visulima/commit/5b40fb9c72f151537e0c32ef10e125b163455742))
|
|
6
|
+
* **deep-clone:** moved from tsup to packem ([5d11363](https://github.com/visulima/visulima/commit/5d11363e060385e653df30be1ddddfe2ee5e069c))
|
|
7
|
+
|
|
8
|
+
### Miscellaneous Chores
|
|
9
|
+
|
|
10
|
+
* changed typescript version back to 5.4.5 ([55d28bb](https://github.com/visulima/visulima/commit/55d28bbdc103718d19f844034b38a0e8e5af798a))
|
|
11
|
+
* clean up ([0c6a87d](https://github.com/visulima/visulima/commit/0c6a87dd9e1f2e755f929c6360b51e3fe377c095))
|
|
12
|
+
* update dev dependencies ([0738f98](https://github.com/visulima/visulima/commit/0738f9810478bb215ce4b2571dc8874c4c503089))
|
|
13
|
+
* updated all dev deps ([ef143ce](https://github.com/visulima/visulima/commit/ef143ce2e15952a0910aa5c8bd78d25de9ebd7f3))
|
|
14
|
+
* updated dev dependencies ([45c2a76](https://github.com/visulima/visulima/commit/45c2a76bc974ecb2c6b172c3af03373d4cc6a5ce))
|
|
15
|
+
* updated dev dependencies ([da46d8e](https://github.com/visulima/visulima/commit/da46d8ef8a964c086060944172f1bd931b7bde9a))
|
|
16
|
+
* updated dev dependencies ([ac67ec1](https://github.com/visulima/visulima/commit/ac67ec1bcba16175d225958e318199f60b10d179))
|
|
17
|
+
* updated dev dependencies ([c889486](https://github.com/visulima/visulima/commit/c889486f8980741f459b993648c1b6d0815e3d66))
|
|
18
|
+
* updated dev dependencies and sorted the package.json ([9571572](https://github.com/visulima/visulima/commit/95715725a8ed053ca24fd1405a55205c79342ecb))
|
|
19
|
+
|
|
20
|
+
### Build System
|
|
21
|
+
|
|
22
|
+
* fixed found audit error, updated all dev package deps, updated deps in apps and examples ([4c51950](https://github.com/visulima/visulima/commit/4c519500dc5504579d35725572920658999885cb))
|
|
23
|
+
|
|
24
|
+
## @visulima/deep-clone [2.1.3](https://github.com/visulima/visulima/compare/@visulima/deep-clone@2.1.2...@visulima/deep-clone@2.1.3) (2024-06-06)
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
### Bug Fixes
|
|
28
|
+
|
|
29
|
+
* allow node v22 ([890d457](https://github.com/visulima/visulima/commit/890d4570f18428e2463944813c0c638b3f142803))
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
### Miscellaneous Chores
|
|
33
|
+
|
|
34
|
+
* changed semantic-release-npm to pnpm ([b6d100a](https://github.com/visulima/visulima/commit/b6d100a2bf3fd026577be48726a37754947f0973))
|
|
35
|
+
* **deps:** updated dev deps ([d91ac38](https://github.com/visulima/visulima/commit/d91ac389cea85a6c6bdc8de97905252a6c467abc))
|
|
36
|
+
* downgrade eslint-plugin-vitest ([0162771](https://github.com/visulima/visulima/commit/0162771e6022e4594486a796bc41e91a2d87bcd8))
|
|
37
|
+
* update dev dependencies ([09c4854](https://github.com/visulima/visulima/commit/09c4854e221fa8b808dfe66d7196d8db2a39b366))
|
|
38
|
+
* updated dev dependencies ([a2e0504](https://github.com/visulima/visulima/commit/a2e0504dc239049434c2482756ff15bdbaac9b54))
|
|
39
|
+
* updated dev dependencies ([abd319c](https://github.com/visulima/visulima/commit/abd319c23576aa1dc751ac874e806bddbc977d51))
|
|
40
|
+
* updated dev dependencies ([0767afe](https://github.com/visulima/visulima/commit/0767afe9be83da6698c1343724400171f952599e))
|
|
41
|
+
* updated dev dependencies ([d7791e3](https://github.com/visulima/visulima/commit/d7791e327917e438757636573b1e5549a97bba7b))
|
|
42
|
+
* updated dev dependencies ([6005345](https://github.com/visulima/visulima/commit/60053456717a3889fc77b4fb5b05d50a662475b2))
|
|
43
|
+
* updated dev dependencies ([87dee15](https://github.com/visulima/visulima/commit/87dee156e797b5dee2557a09ad32c935d851847c))
|
|
44
|
+
* updated dev dependencies ([bf2c635](https://github.com/visulima/visulima/commit/bf2c635859601cc97858226e70f47219eabc213e))
|
|
45
|
+
* updated dev dependencies ([f67c7f1](https://github.com/visulima/visulima/commit/f67c7f14ecc328ed91d06d01ac6514e8bce72cb4))
|
|
46
|
+
|
|
1
47
|
## @visulima/deep-clone [2.1.2](https://github.com/visulima/visulima/compare/@visulima/deep-clone@2.1.1...@visulima/deep-clone@2.1.2) (2024-03-27)
|
|
2
48
|
|
|
3
49
|
|
package/README.md
CHANGED
|
File without changes
|
package/dist/handler.cjs
CHANGED
|
@@ -1,69 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var chunkZJWITT73_cjs = require('./chunk-ZJWITT73.cjs');
|
|
4
|
-
require('./chunk-ULIBPEBE.cjs');
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
Object.defineProperty(exports, 'copyArrayBuffer', {
|
|
9
|
-
enumerable: true,
|
|
10
|
-
get: function () { return chunkZJWITT73_cjs.c; }
|
|
11
|
-
});
|
|
12
|
-
Object.defineProperty(exports, 'copyArrayLoose', {
|
|
13
|
-
enumerable: true,
|
|
14
|
-
get: function () { return chunkZJWITT73_cjs.a; }
|
|
15
|
-
});
|
|
16
|
-
Object.defineProperty(exports, 'copyArrayStrict', {
|
|
17
|
-
enumerable: true,
|
|
18
|
-
get: function () { return chunkZJWITT73_cjs.b; }
|
|
19
|
-
});
|
|
20
|
-
Object.defineProperty(exports, 'copyBlob', {
|
|
21
|
-
enumerable: true,
|
|
22
|
-
get: function () { return chunkZJWITT73_cjs.d; }
|
|
23
|
-
});
|
|
24
|
-
Object.defineProperty(exports, 'copyDataView', {
|
|
25
|
-
enumerable: true,
|
|
26
|
-
get: function () { return chunkZJWITT73_cjs.e; }
|
|
27
|
-
});
|
|
28
|
-
Object.defineProperty(exports, 'copyDate', {
|
|
29
|
-
enumerable: true,
|
|
30
|
-
get: function () { return chunkZJWITT73_cjs.f; }
|
|
31
|
-
});
|
|
32
|
-
Object.defineProperty(exports, 'copyError', {
|
|
33
|
-
enumerable: true,
|
|
34
|
-
get: function () { return chunkZJWITT73_cjs.g; }
|
|
35
|
-
});
|
|
36
|
-
Object.defineProperty(exports, 'copyMapLoose', {
|
|
37
|
-
enumerable: true,
|
|
38
|
-
get: function () { return chunkZJWITT73_cjs.h; }
|
|
39
|
-
});
|
|
40
|
-
Object.defineProperty(exports, 'copyMapStrict', {
|
|
41
|
-
enumerable: true,
|
|
42
|
-
get: function () { return chunkZJWITT73_cjs.i; }
|
|
43
|
-
});
|
|
44
|
-
Object.defineProperty(exports, 'copyObjectLoose', {
|
|
45
|
-
enumerable: true,
|
|
46
|
-
get: function () { return chunkZJWITT73_cjs.j; }
|
|
47
|
-
});
|
|
48
|
-
Object.defineProperty(exports, 'copyObjectStrict', {
|
|
49
|
-
enumerable: true,
|
|
50
|
-
get: function () { return chunkZJWITT73_cjs.k; }
|
|
51
|
-
});
|
|
52
|
-
Object.defineProperty(exports, 'copyRegExpLoose', {
|
|
53
|
-
enumerable: true,
|
|
54
|
-
get: function () { return chunkZJWITT73_cjs.l; }
|
|
55
|
-
});
|
|
56
|
-
Object.defineProperty(exports, 'copyRegExpStrict', {
|
|
57
|
-
enumerable: true,
|
|
58
|
-
get: function () { return chunkZJWITT73_cjs.m; }
|
|
59
|
-
});
|
|
60
|
-
Object.defineProperty(exports, 'copySetLoose', {
|
|
61
|
-
enumerable: true,
|
|
62
|
-
get: function () { return chunkZJWITT73_cjs.n; }
|
|
63
|
-
});
|
|
64
|
-
Object.defineProperty(exports, 'copySetStrict', {
|
|
65
|
-
enumerable: true,
|
|
66
|
-
get: function () { return chunkZJWITT73_cjs.o; }
|
|
67
|
-
});
|
|
68
|
-
//# sourceMappingURL=out.js.map
|
|
69
|
-
//# sourceMappingURL=handler.cjs.map
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./packem_shared/copyArrayLoose-ukX__AC4.cjs"),p=require("./packem_shared/copyArrayBuffer-CErFt6r1.cjs"),y=require("./packem_shared/copyBlob-CCIQ88PB.cjs"),s=require("./packem_shared/copyDataView-C9SuIdXo.cjs"),i=require("./packem_shared/copyDate-CfZZ3WAO.cjs"),a=require("./packem_shared/copyError-DGbUXsSU.cjs"),e=require("./packem_shared/copyMapLoose-CuTK-fBO.cjs"),c=require("./packem_shared/copyObjectLoose-CbVJDz5e.cjs"),r=require("./packem_shared/copyRegExpLoose-DzJvEX_n.cjs"),t=require("./packem_shared/copySetLoose-v1Cjaq91.cjs");exports.copyArrayLoose=o.copyArrayLoose;exports.copyArrayStrict=o.copyArrayStrict;exports.copyArrayBuffer=p;exports.copyBlob=y;exports.copyDataView=s;exports.copyDate=i;exports.copyError=a;exports.copyMapLoose=e.copyMapLoose;exports.copyMapStrict=e.copyMapStrict;exports.copyObjectLoose=c.copyObjectLoose;exports.copyObjectStrict=c.copyObjectStrict;exports.copyRegExpLoose=r.copyRegExpLoose;exports.copyRegExpStrict=r.copyRegExpStrict;exports.copySetLoose=t.copySetLoose;exports.copySetStrict=t.copySetStrict;
|
package/dist/handler.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { S as State, T as TypedArray } from './types-
|
|
1
|
+
import { S as State, T as TypedArray } from './packem_shared/types-_Qve7nv8.cjs';
|
|
2
2
|
|
|
3
3
|
declare const copyArrayLoose: <Value extends unknown[]>(array: Value, state: State) => Value;
|
|
4
4
|
declare const copyArrayStrict: <Value extends unknown[]>(array: Value, state: State) => Value;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { S as State, T as TypedArray } from './packem_shared/types-_Qve7nv8.mjs';
|
|
2
|
+
|
|
3
|
+
declare const copyArrayLoose: <Value extends unknown[]>(array: Value, state: State) => Value;
|
|
4
|
+
declare const copyArrayStrict: <Value extends unknown[]>(array: Value, state: State) => Value;
|
|
5
|
+
|
|
6
|
+
declare const copyArrayBuffer: <Value extends ArrayBuffer | ArrayBufferView | Buffer | TypedArray>(arrayBuffer: Value) => Value;
|
|
7
|
+
|
|
8
|
+
declare const copyBlob: <Value extends Blob>(blob: Value) => Value;
|
|
9
|
+
|
|
10
|
+
declare const copyDataView: <Value extends DataView>(dataView: Value) => Value;
|
|
11
|
+
|
|
12
|
+
declare const copyDate: <Value extends Date>(date: Value) => Value;
|
|
13
|
+
|
|
14
|
+
type ExtendedError = Error & {
|
|
15
|
+
code?: any;
|
|
16
|
+
errno?: any;
|
|
17
|
+
syscall?: any;
|
|
18
|
+
};
|
|
19
|
+
declare const copyError: <Value extends EvalError | ExtendedError | RangeError | ReferenceError | SyntaxError | TypeError | URIError>(object: Value, state: State) => Value;
|
|
20
|
+
|
|
21
|
+
declare const copyMapLoose: <Value extends Map<unknown, unknown>>(map: Value, state: State) => Value;
|
|
22
|
+
declare const copyMapStrict: <Value extends Map<unknown, unknown>>(map: Value, state: State) => Value;
|
|
23
|
+
|
|
24
|
+
declare const copyObjectLoose: <Value extends Record<PropertyKey, unknown>>(object: Value, state: State) => Value;
|
|
25
|
+
declare const copyObjectStrict: <Value extends Record<PropertyKey, unknown>>(object: Value, state: State) => Value;
|
|
26
|
+
|
|
27
|
+
declare const copyRegExpLoose: <Value extends RegExp>(regExp: Value) => Value;
|
|
28
|
+
declare const copyRegExpStrict: <Value extends RegExp>(regExp: Value, state: State) => Value;
|
|
29
|
+
|
|
30
|
+
declare const copySetLoose: <Value extends Set<unknown>>(set: Value, state: State) => Value;
|
|
31
|
+
declare const copySetStrict: <Value extends Set<unknown>>(set: Value, state: State) => Value;
|
|
32
|
+
|
|
33
|
+
export { copyArrayBuffer, copyArrayLoose, copyArrayStrict, copyBlob, copyDataView, copyDate, copyError, copyMapLoose, copyMapStrict, copyObjectLoose, copyObjectStrict, copyRegExpLoose, copyRegExpStrict, copySetLoose, copySetStrict };
|
package/dist/handler.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { S as State, T as TypedArray } from './types-
|
|
1
|
+
import { S as State, T as TypedArray } from './packem_shared/types-_Qve7nv8.d.mjs';
|
|
2
2
|
|
|
3
3
|
declare const copyArrayLoose: <Value extends unknown[]>(array: Value, state: State) => Value;
|
|
4
4
|
declare const copyArrayStrict: <Value extends unknown[]>(array: Value, state: State) => Value;
|
package/dist/handler.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{copyArrayLoose as t,copyArrayStrict as e}from"./packem_shared/copyArrayLoose-B2xEXxZi.mjs";import{default as c}from"./packem_shared/copyArrayBuffer-hX6Bv2Yc.mjs";import{default as y}from"./packem_shared/copyBlob-zWtjc8BU.mjs";import{default as x}from"./packem_shared/copyDataView-CHZxqd6h.mjs";import{default as s}from"./packem_shared/copyDate-CSebYDy0.mjs";import{default as i}from"./packem_shared/copyError-BzQAysGw.mjs";import{copyMapLoose as u,copyMapStrict as d}from"./packem_shared/copyMapLoose-CorlUnMI.mjs";import{copyObjectLoose as b,copyObjectStrict as A}from"./packem_shared/copyObjectLoose-DrrTtApt.mjs";import{copyRegExpLoose as g,copyRegExpStrict as j}from"./packem_shared/copyRegExpLoose-BvCnMoGQ.mjs";import{copySetLoose as D,copySetStrict as M}from"./packem_shared/copySetLoose-FGAEcE9e.mjs";export{c as copyArrayBuffer,t as copyArrayLoose,e as copyArrayStrict,y as copyBlob,x as copyDataView,s as copyDate,i as copyError,u as copyMapLoose,d as copyMapStrict,b as copyObjectLoose,A as copyObjectStrict,g as copyRegExpLoose,j as copyRegExpStrict,D as copySetLoose,M as copySetStrict};
|
package/dist/index.cjs
CHANGED
|
@@ -1,10 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var chunkZJWITT73_cjs = require('./chunk-ZJWITT73.cjs');
|
|
4
|
-
require('./chunk-ULIBPEBE.cjs');
|
|
5
|
-
|
|
6
|
-
var D=o=>typeof o=="object"&&o!==null||typeof o=="function",E={Array:chunkZJWITT73_cjs.a,ArrayBuffer:chunkZJWITT73_cjs.c,Blob:chunkZJWITT73_cjs.d,DataView:chunkZJWITT73_cjs.e,Date:chunkZJWITT73_cjs.f,Error:chunkZJWITT73_cjs.g,Function:(o,t)=>o,Map:chunkZJWITT73_cjs.h,Object:chunkZJWITT73_cjs.j,Promise:o=>{throw new TypeError(`${o.constructor.name} objects cannot be cloned`)},RegExp:chunkZJWITT73_cjs.l,Set:chunkZJWITT73_cjs.n,SharedArrayBuffer:(o,t)=>{throw new TypeError(`${o.constructor.name} objects cannot be cloned`)},WeakMap:o=>{throw new TypeError(`${o.constructor.name} objects cannot be cloned`)},WeakSet:o=>{throw new TypeError(`${o.constructor.name} objects cannot be cloned`)}},V=(o,t)=>{if(!D(o))return o;let e={...E,...t?.strict?{Array:chunkZJWITT73_cjs.b,Map:chunkZJWITT73_cjs.i,Object:chunkZJWITT73_cjs.k,RegExp:chunkZJWITT73_cjs.m,Set:chunkZJWITT73_cjs.o}:{},...t?.handler},c=new WeakMap,i=(r,n)=>{if(!D(r))return r;if(n.cache.has(r))return n.cache.get(r);if(Array.isArray(r))return e.Array(r,n);if(typeof r=="object"&&r.constructor===Object&&r.nodeType===void 0)return e.Object(r,n);if(r.nodeType!==void 0&&r.cloneNode!==void 0)return r.cloneNode(!0);if(r instanceof Date)return e.Date(r,n);if(r instanceof RegExp)return e.RegExp(r,n);if(r instanceof Map)return e.Map(r,n);if(r instanceof Set)return e.Set(r,n);if(r instanceof Error)return e.Error(r,n);if(r instanceof ArrayBuffer||r instanceof Uint8Array||r instanceof Uint8ClampedArray||r instanceof Int8Array||r instanceof Uint16Array||r instanceof Int16Array||r instanceof Uint32Array||r instanceof Int32Array||r instanceof Float32Array||r instanceof Float64Array)return e.ArrayBuffer(r,n);if(r instanceof Blob)return e.Blob(r,n);if(r instanceof DataView)return e.DataView(r,n);if(r instanceof SharedArrayBuffer)return e.SharedArrayBuffer(r,n);if(r instanceof Promise)return e.Promise(r,n);if(r instanceof WeakMap)return e.WeakMap(r,n);if(r instanceof WeakSet)return e.WeakSet(r,n);if(r instanceof Function)return e.Function(r,n);if(typeof r=="object")return e.Object(r,n);throw new TypeError(`Type of ${typeof r} cannot be cloned`,r)},M=i(o,{cache:c,clone:i});return c=null,M};
|
|
7
|
-
|
|
8
|
-
exports.deepClone = V;
|
|
9
|
-
//# sourceMappingURL=out.js.map
|
|
10
|
-
//# sourceMappingURL=index.cjs.map
|
|
1
|
+
"use strict";var d=Object.defineProperty;var f=(t,r)=>d(t,"name",{value:r,configurable:!0});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const y=require("./packem_shared/copyArrayLoose-ukX__AC4.cjs"),S=require("./packem_shared/copyArrayBuffer-CErFt6r1.cjs"),j=require("./packem_shared/copyBlob-CCIQ88PB.cjs"),E=require("./packem_shared/copyDataView-C9SuIdXo.cjs"),w=require("./packem_shared/copyDate-CfZZ3WAO.cjs"),h=require("./packem_shared/copyError-DGbUXsSU.cjs"),p=require("./packem_shared/copyMapLoose-CuTK-fBO.cjs"),u=require("./packem_shared/copyObjectLoose-CbVJDz5e.cjs"),l=require("./packem_shared/copyRegExpLoose-DzJvEX_n.cjs"),b=require("./packem_shared/copySetLoose-v1Cjaq91.cjs");var M=Object.defineProperty,c=f((t,r)=>M(t,"name",{value:r,configurable:!0}),"t");const s=c(t=>typeof t=="object"&&t!==null||typeof t=="function","canValueHaveProperties"),B={Array:y.copyArrayLoose,ArrayBuffer:S,Blob:j,DataView:E,Date:w,Error:h,Function:c((t,r)=>t,"Function"),Map:p.copyMapLoose,Object:u.copyObjectLoose,Promise:c(t=>{throw new TypeError(`${t.constructor.name} objects cannot be cloned`)},"Promise"),RegExp:l.copyRegExpLoose,Set:b.copySetLoose,SharedArrayBuffer:c((t,r)=>{throw new TypeError(`${t.constructor.name} objects cannot be cloned`)},"SharedArrayBuffer"),WeakMap:c(t=>{throw new TypeError(`${t.constructor.name} objects cannot be cloned`)},"WeakMap"),WeakSet:c(t=>{throw new TypeError(`${t.constructor.name} objects cannot be cloned`)},"WeakSet")},g=c((t,r)=>{if(!s(t))return t;const n={...B,...r?.strict?{Array:y.copyArrayStrict,Map:p.copyMapStrict,Object:u.copyObjectStrict,RegExp:l.copyRegExpStrict,Set:b.copySetStrict}:{},...r?.handler};let a=new WeakMap;const i=c((e,o)=>{if(!s(e))return e;if(o.cache.has(e))return o.cache.get(e);if(Array.isArray(e))return n.Array(e,o);if(typeof e=="object"&&e.constructor===Object&&e.nodeType===void 0)return n.Object(e,o);if(e.nodeType!==void 0&&e.cloneNode!==void 0)return e.cloneNode(!0);if(e instanceof Date)return n.Date(e,o);if(e instanceof RegExp)return n.RegExp(e,o);if(e instanceof Map)return n.Map(e,o);if(e instanceof Set)return n.Set(e,o);if(e instanceof Error)return n.Error(e,o);if(e instanceof ArrayBuffer||e instanceof Uint8Array||e instanceof Uint8ClampedArray||e instanceof Int8Array||e instanceof Uint16Array||e instanceof Int16Array||e instanceof Uint32Array||e instanceof Int32Array||e instanceof Float32Array||e instanceof Float64Array)return n.ArrayBuffer(e,o);if(e instanceof Blob)return n.Blob(e,o);if(e instanceof DataView)return n.DataView(e,o);if(e instanceof SharedArrayBuffer)return n.SharedArrayBuffer(e,o);if(e instanceof Promise)return n.Promise(e,o);if(e instanceof WeakMap)return n.WeakMap(e,o);if(e instanceof WeakSet)return n.WeakSet(e,o);if(e instanceof Function)return n.Function(e,o);if(typeof e=="object")return n.Object(e,o);throw new TypeError(`Type of ${typeof e} cannot be cloned`,e)},"clone"),A=i(t,{cache:a,clone:i});return a=null,A},"deepClone");exports.deepClone=g;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { O as Options } from './types-
|
|
2
|
-
export { S as State } from './types-
|
|
1
|
+
import { O as Options } from './packem_shared/types-_Qve7nv8.cjs';
|
|
2
|
+
export { S as State } from './packem_shared/types-_Qve7nv8.cjs';
|
|
3
3
|
|
|
4
4
|
type DeepReadwrite<T> = T extends object | [] ? {
|
|
5
5
|
-readonly [P in keyof T]: DeepReadwrite<T[P]>;
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { O as Options } from './packem_shared/types-_Qve7nv8.mjs';
|
|
2
|
+
export { S as State } from './packem_shared/types-_Qve7nv8.mjs';
|
|
3
|
+
|
|
4
|
+
type DeepReadwrite<T> = T extends object | [] ? {
|
|
5
|
+
-readonly [P in keyof T]: DeepReadwrite<T[P]>;
|
|
6
|
+
} : T;
|
|
7
|
+
declare const deepClone: <T>(originalData: T, options?: Options) => DeepReadwrite<T>;
|
|
8
|
+
|
|
9
|
+
export { Options, deepClone };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { O as Options } from './types-
|
|
2
|
-
export { S as State } from './types-
|
|
1
|
+
import { O as Options } from './packem_shared/types-_Qve7nv8.d.mjs';
|
|
2
|
+
export { S as State } from './packem_shared/types-_Qve7nv8.d.mjs';
|
|
3
3
|
|
|
4
4
|
type DeepReadwrite<T> = T extends object | [] ? {
|
|
5
5
|
-readonly [P in keyof T]: DeepReadwrite<T[P]>;
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var y=Object.defineProperty;var f=(t,r)=>y(t,"name",{value:r,configurable:!0});import{copyArrayLoose as u,copyArrayStrict as m}from"./packem_shared/copyArrayLoose-B2xEXxZi.mjs";import l from"./packem_shared/copyArrayBuffer-hX6Bv2Yc.mjs";import b from"./packem_shared/copyBlob-zWtjc8BU.mjs";import A from"./packem_shared/copyDataView-CHZxqd6h.mjs";import d from"./packem_shared/copyDate-CSebYDy0.mjs";import S from"./packem_shared/copyError-BzQAysGw.mjs";import{copyMapLoose as j,copyMapStrict as h}from"./packem_shared/copyMapLoose-CorlUnMI.mjs";import{copyObjectLoose as w,copyObjectStrict as E}from"./packem_shared/copyObjectLoose-DrrTtApt.mjs";import{copyRegExpLoose as M,copyRegExpStrict as B}from"./packem_shared/copyRegExpLoose-BvCnMoGQ.mjs";import{copySetLoose as k,copySetStrict as W}from"./packem_shared/copySetLoose-FGAEcE9e.mjs";var g=Object.defineProperty,a=f((t,r)=>g(t,"name",{value:r,configurable:!0}),"t");const p=a(t=>typeof t=="object"&&t!==null||typeof t=="function","canValueHaveProperties"),O={Array:u,ArrayBuffer:l,Blob:b,DataView:A,Date:d,Error:S,Function:a((t,r)=>t,"Function"),Map:j,Object:w,Promise:a(t=>{throw new TypeError(`${t.constructor.name} objects cannot be cloned`)},"Promise"),RegExp:M,Set:k,SharedArrayBuffer:a((t,r)=>{throw new TypeError(`${t.constructor.name} objects cannot be cloned`)},"SharedArrayBuffer"),WeakMap:a(t=>{throw new TypeError(`${t.constructor.name} objects cannot be cloned`)},"WeakMap"),WeakSet:a(t=>{throw new TypeError(`${t.constructor.name} objects cannot be cloned`)},"WeakSet")},C=a((t,r)=>{if(!p(t))return t;const o={...O,...r?.strict?{Array:m,Map:h,Object:E,RegExp:B,Set:W}:{},...r?.handler};let c=new WeakMap;const i=a((e,n)=>{if(!p(e))return e;if(n.cache.has(e))return n.cache.get(e);if(Array.isArray(e))return o.Array(e,n);if(typeof e=="object"&&e.constructor===Object&&e.nodeType===void 0)return o.Object(e,n);if(e.nodeType!==void 0&&e.cloneNode!==void 0)return e.cloneNode(!0);if(e instanceof Date)return o.Date(e,n);if(e instanceof RegExp)return o.RegExp(e,n);if(e instanceof Map)return o.Map(e,n);if(e instanceof Set)return o.Set(e,n);if(e instanceof Error)return o.Error(e,n);if(e instanceof ArrayBuffer||e instanceof Uint8Array||e instanceof Uint8ClampedArray||e instanceof Int8Array||e instanceof Uint16Array||e instanceof Int16Array||e instanceof Uint32Array||e instanceof Int32Array||e instanceof Float32Array||e instanceof Float64Array)return o.ArrayBuffer(e,n);if(e instanceof Blob)return o.Blob(e,n);if(e instanceof DataView)return o.DataView(e,n);if(e instanceof SharedArrayBuffer)return o.SharedArrayBuffer(e,n);if(e instanceof Promise)return o.Promise(e,n);if(e instanceof WeakMap)return o.WeakMap(e,n);if(e instanceof WeakSet)return o.WeakSet(e,n);if(e instanceof Function)return o.Function(e,n);if(typeof e=="object")return o.Object(e,n);throw new TypeError(`Type of ${typeof e} cannot be cloned`,e)},"clone"),s=i(t,{cache:c,clone:i});return c=null,s},"deepClone");export{C as deepClone};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var f=Object.defineProperty;var a=(r,t)=>f(r,"name",{value:t,configurable:!0});var o=Object.defineProperty,A=a((r,t)=>o(r,"name",{value:t,configurable:!0}),"y");const i=A(r=>{const t={BigInt64Array,BigUint64Array,Buffer:Buffer.from,Float32Array,Float64Array,Int8Array,Int16Array,Int32Array,Uint8Array,Uint8ClampedArray,Uint16Array,Uint32Array};if(r instanceof ArrayBuffer){const e=new ArrayBuffer(r.byteLength),y=new Uint8Array(r);return new Uint8Array(e).set(y),e}const n=t[r.constructor.name]??void 0;return n?new n(r):new r.constructor([...r.buffer],r.byteOffset,r.length)},"copyArrayBuffer");module.exports=i;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var f=Object.defineProperty;var a=(r,t)=>f(r,"name",{value:t,configurable:!0});var o=Object.defineProperty,A=a((r,t)=>o(r,"name",{value:t,configurable:!0}),"y");const u=A(r=>{const t={BigInt64Array,BigUint64Array,Buffer:Buffer.from,Float32Array,Float64Array,Int8Array,Int16Array,Int32Array,Uint8Array,Uint8ClampedArray,Uint16Array,Uint32Array};if(r instanceof ArrayBuffer){const e=new ArrayBuffer(r.byteLength),y=new Uint8Array(r);return new Uint8Array(e).set(y),e}const n=t[r.constructor.name]??void 0;return n?new n(r):new r.constructor([...r.buffer],r.byteOffset,r.length)},"copyArrayBuffer");export{u as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var n=Object.defineProperty;var e=(r,o)=>n(r,"name",{value:o,configurable:!0});import p from"./copyOwnProperties-QEhjt2x8.mjs";var s=Object.defineProperty,a=e((r,o)=>s(r,"name",{value:o,configurable:!0}),"u");const u=a((r,o)=>{const t=[];o.cache.set(r,t);for(let c=0,{length:y}=r;c<y;++c)t[c]=o.clone(r[c],o);return t},"copyArrayLoose"),f=a((r,o)=>{const t=[];return o.cache.set(r,t),p(r,t,o)},"copyArrayStrict");export{u as copyArrayLoose,f as copyArrayStrict};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var s=Object.defineProperty;var c=(r,o)=>s(r,"name",{value:o,configurable:!0});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./copyOwnProperties-Zk6Vg6Oe.cjs");var i=Object.defineProperty,y=c((r,o)=>i(r,"name",{value:o,configurable:!0}),"u");const p=y((r,o)=>{const e=[];o.cache.set(r,e);for(let t=0,{length:a}=r;t<a;++t)e[t]=o.clone(r[t],o);return e},"copyArrayLoose"),l=y((r,o)=>{const e=[];return o.cache.set(r,e),n(r,e,o)},"copyArrayStrict");exports.copyArrayLoose=p;exports.copyArrayStrict=l;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var s=Object.defineProperty;var r=(e,t)=>s(e,"name",{value:t,configurable:!0});var a=Object.defineProperty,c=r((e,t)=>a(e,"name",{value:t,configurable:!0}),"a");const o=c(e=>e.slice(0,e.size,e.type),"copyBlob");module.exports=o;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var o=Object.defineProperty;var t=(e,a)=>o(e,"name",{value:a,configurable:!0});var r=Object.defineProperty,c=t((e,a)=>r(e,"name",{value:a,configurable:!0}),"a");const s=c(e=>e.slice(0,e.size,e.type),"copyBlob");export{s as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var t=Object.defineProperty;var a=(e,r)=>t(e,"name",{value:r,configurable:!0});const c=require("./copyArrayBuffer-CErFt6r1.cjs");var o=Object.defineProperty,f=a((e,r)=>o(e,"name",{value:r,configurable:!0}),"a");const i=f(e=>new DataView(c(e.buffer)),"copyDataView");module.exports=i;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var t=Object.defineProperty;var r=(e,a)=>t(e,"name",{value:a,configurable:!0});import o from"./copyArrayBuffer-hX6Bv2Yc.mjs";var f=Object.defineProperty,i=r((e,a)=>f(e,"name",{value:a,configurable:!0}),"a");const p=i(e=>new DataView(o(e.buffer)),"copyDataView");export{p as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var r=Object.defineProperty;var t=(e,a)=>r(e,"name",{value:a,configurable:!0});var n=Object.defineProperty,o=t((e,a)=>n(e,"name",{value:a,configurable:!0}),"a");const l=o(e=>new Date(e.getTime()),"copyDate");export{l as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var r=Object.defineProperty;var a=(e,t)=>r(e,"name",{value:t,configurable:!0});var c=Object.defineProperty,n=a((e,t)=>c(e,"name",{value:t,configurable:!0}),"a");const o=n(e=>new Date(e.getTime()),"copyDate");module.exports=o;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var s=Object.defineProperty;var a=(e,o)=>s(e,"name",{value:o,configurable:!0});import t from"./copyOwnProperties-QEhjt2x8.mjs";var n=Object.defineProperty,r=a((e,o)=>n(e,"name",{value:o,configurable:!0}),"o");const u=r((e,o)=>{const c=new e.constructor(e.message);return e.stack&&(c.stack=e.stack),e.code&&(c.code=e.code),e.errno&&(c.errno=e.errno),e.syscall&&(c.syscall=e.syscall),t(e,c,o)},"copyError");export{u as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var t=Object.defineProperty;var s=(e,c)=>t(e,"name",{value:c,configurable:!0});const r=require("./copyOwnProperties-Zk6Vg6Oe.cjs");var a=Object.defineProperty,n=s((e,c)=>a(e,"name",{value:c,configurable:!0}),"o");const l=n((e,c)=>{const o=new e.constructor(e.message);return e.stack&&(o.stack=e.stack),e.code&&(o.code=e.code),e.errno&&(o.errno=e.errno),e.syscall&&(o.syscall=e.syscall),r(e,o,c)},"copyError");module.exports=l;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var i=Object.defineProperty;var e=(c,o)=>i(c,"name",{value:o,configurable:!0});import n from"./copyOwnProperties-QEhjt2x8.mjs";var s=Object.defineProperty,r=e((c,o)=>s(c,"name",{value:o,configurable:!0}),"t");const y=r((c,o)=>{const t=new Map;return o.cache.set(c,t),c.forEach((a,p)=>{t.set(p,o.clone(a,o))}),t},"copyMapLoose"),u=r((c,o)=>n(c,y(c,o),o),"copyMapStrict");export{y as copyMapLoose,u as copyMapStrict};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var i=Object.defineProperty;var c=(e,o)=>i(e,"name",{value:o,configurable:!0});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./copyOwnProperties-Zk6Vg6Oe.cjs");var y=Object.defineProperty,r=c((e,o)=>y(e,"name",{value:o,configurable:!0}),"t");const p=r((e,o)=>{const t=new Map;return o.cache.set(e,t),e.forEach((a,s)=>{t.set(s,o.clone(a,o))}),t},"copyMapLoose"),u=r((e,o)=>n(e,p(e,o),o),"copyMapStrict");exports.copyMapLoose=p;exports.copyMapStrict=u;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var l=Object.defineProperty;var O=(e,t)=>l(e,"name",{value:t,configurable:!0});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const y=require("./copyOwnProperties-Zk6Vg6Oe.cjs"),b=require("./getCleanClone-DLZ_E9xd.cjs");var i=Object.defineProperty,s=O((e,t)=>i(e,"name",{value:t,configurable:!0}),"l");const p=s((e,t)=>{Object.isExtensible(e)||Object.preventExtensions(t),Object.isSealed(e)&&Object.seal(t),Object.isFrozen(e)&&Object.freeze(t)},"copyObjectIsFunctions"),a=s((e,t)=>{const o=b(e);t.cache.set(e,o);for(const c in e)Object.hasOwnProperty.call(e,c)&&(o[c]=t.clone(e[c],t));const r=Object.getOwnPropertySymbols(e);for(let c=0,{length:j}=r,n;c<j;++c)n=r[c],Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=t.clone(e[n],t));return p(e,o),o},"copyObjectLoose"),u=s((e,t)=>{const o=b(e);t.cache.set(e,o);const r=y(e,o,t),c=Object.getPrototypeOf(e);return Object.getPrototypeOf(r)!==c&&Object.setPrototypeOf(r,c),p(e,o),r},"copyObjectStrict");exports.copyObjectLoose=a;exports.copyObjectStrict=u;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var l=Object.defineProperty;var O=(t,e)=>l(t,"name",{value:e,configurable:!0});import y from"./copyOwnProperties-QEhjt2x8.mjs";import b from"./getCleanClone-D0FN9QGR.mjs";var i=Object.defineProperty,s=O((t,e)=>i(t,"name",{value:e,configurable:!0}),"l");const p=s((t,e)=>{Object.isExtensible(t)||Object.preventExtensions(e),Object.isSealed(t)&&Object.seal(e),Object.isFrozen(t)&&Object.freeze(e)},"copyObjectIsFunctions"),u=s((t,e)=>{const c=b(t);e.cache.set(t,c);for(const o in t)Object.hasOwnProperty.call(t,o)&&(c[o]=e.clone(t[o],e));const r=Object.getOwnPropertySymbols(t);for(let o=0,{length:j}=r,n;o<j;++o)n=r[o],Object.prototype.propertyIsEnumerable.call(t,n)&&(c[n]=e.clone(t[n],e));return p(t,c),c},"copyObjectLoose"),P=s((t,e)=>{const c=b(t);e.cache.set(t,c);const r=y(t,c,e),o=Object.getPrototypeOf(t);return Object.getPrototypeOf(r)!==o&&Object.setPrototypeOf(r,o),p(t,c),r},"copyObjectStrict");export{u as copyObjectLoose,P as copyObjectStrict};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var i=Object.defineProperty;var n=(e,t)=>i(e,"name",{value:t,configurable:!0});var s=Object.defineProperty,a=n((e,t)=>s(e,"name",{value:t,configurable:!0}),"s");const p=a(e=>[...Object.getOwnPropertyNames(e),...Object.getOwnPropertySymbols(e)],"getStrictProperties"),O=a((e,t,o)=>{const l=p(e);for(const r of l){if(r==="callee"||r==="caller")continue;const c=Object.getOwnPropertyDescriptor(e,r);if(!c){t[r]=o.clone(e[r],o);continue}!c.get&&!c.set&&(c.value=o.clone(c.value,o));try{Object.defineProperty(t,r,c)}catch{t[r]=c.value}}return t},"copyOwnProperties");export{O as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var i=Object.defineProperty;var n=(e,t)=>i(e,"name",{value:t,configurable:!0});var l=Object.defineProperty,s=n((e,t)=>l(e,"name",{value:t,configurable:!0}),"s");const p=s(e=>[...Object.getOwnPropertyNames(e),...Object.getOwnPropertySymbols(e)],"getStrictProperties"),u=s((e,t,o)=>{const a=p(e);for(const r of a){if(r==="callee"||r==="caller")continue;const c=Object.getOwnPropertyDescriptor(e,r);if(!c){t[r]=o.clone(e[r],o);continue}!c.get&&!c.set&&(c.value=o.clone(c.value,o));try{Object.defineProperty(t,r,c)}catch{t[r]=c.value}}return t},"copyOwnProperties");module.exports=u;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var p=Object.defineProperty;var r=(e,o)=>p(e,"name",{value:o,configurable:!0});import n from"./copyOwnProperties-QEhjt2x8.mjs";var s=Object.defineProperty,t=r((e,o)=>s(e,"name",{value:o,configurable:!0}),"o");const x=t(e=>{const o=new RegExp(e.source,e.flags);return o.lastIndex=e.lastIndex,o},"copyRegExpLoose"),i=t((e,o)=>{const c=new RegExp(e.source,e.flags);return n(e,c,o)},"copyRegExpStrict");export{x as copyRegExpLoose,i as copyRegExpStrict};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var p=Object.defineProperty;var t=(e,o)=>p(e,"name",{value:o,configurable:!0});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./copyOwnProperties-Zk6Vg6Oe.cjs");var n=Object.defineProperty,r=t((e,o)=>n(e,"name",{value:o,configurable:!0}),"o");const g=r(e=>{const o=new RegExp(e.source,e.flags);return o.lastIndex=e.lastIndex,o},"copyRegExpLoose"),a=r((e,o)=>{const c=new RegExp(e.source,e.flags);return s(e,c,o)},"copyRegExpStrict");exports.copyRegExpLoose=g;exports.copyRegExpStrict=a;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var a=Object.defineProperty;var o=(e,t)=>a(e,"name",{value:t,configurable:!0});import p from"./copyOwnProperties-QEhjt2x8.mjs";var S=Object.defineProperty,r=o((e,t)=>S(e,"name",{value:t,configurable:!0}),"n");const i=r((e,t)=>{const c=new Set;return t.cache.set(e,c),e.forEach(n=>{c.add(t.clone(n,t))}),c},"copySetLoose"),f=r((e,t)=>p(e,i(e,t),t),"copySetStrict");export{i as copySetLoose,f as copySetStrict};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var a=Object.defineProperty;var c=(t,e)=>a(t,"name",{value:e,configurable:!0});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./copyOwnProperties-Zk6Vg6Oe.cjs");var p=Object.defineProperty,r=c((t,e)=>p(t,"name",{value:e,configurable:!0}),"n");const n=r((t,e)=>{const o=new Set;return e.cache.set(t,o),t.forEach(S=>{o.add(e.clone(S,e))}),o},"copySetLoose"),s=r((t,e)=>i(t,n(t,e),e),"copySetStrict");exports.copySetLoose=n;exports.copySetStrict=s;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var c=Object.defineProperty;var r=(e,t)=>c(e,"name",{value:t,configurable:!0});var n=Object.defineProperty,o=r((e,t)=>n(e,"name",{value:t,configurable:!0}),"r");const u=o(e=>{if(!e)return Object.create(null);const t=e.constructor;if(t===Object)return e===Object.prototype?{}:Object.create(e);if(~Function.prototype.toString.call(t).indexOf("[native code]"))try{return new t}catch{}return Object.create(e)},"getCleanClone");export{u as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var c=Object.defineProperty;var r=(e,t)=>c(e,"name",{value:t,configurable:!0});var n=Object.defineProperty,o=r((e,t)=>n(e,"name",{value:t,configurable:!0}),"r");const a=o(e=>{if(!e)return Object.create(null);const t=e.constructor;if(t===Object)return e===Object.prototype?{}:Object.create(e);if(~Function.prototype.toString.call(t).indexOf("[native code]"))try{return new t}catch{}return Object.create(e)},"getCleanClone");module.exports=a;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
type InternalHandler<Value> = (value: Value, state: State) => Value;
|
|
2
|
+
interface State {
|
|
3
|
+
cache: WeakMap<any, unknown>;
|
|
4
|
+
clone: InternalHandler<unknown>;
|
|
5
|
+
}
|
|
6
|
+
type Options = {
|
|
7
|
+
handler?: {
|
|
8
|
+
Array: InternalHandler<unknown[]>;
|
|
9
|
+
ArrayBuffer: InternalHandler<ArrayBuffer>;
|
|
10
|
+
Blob: InternalHandler<Blob>;
|
|
11
|
+
DataView: InternalHandler<DataView>;
|
|
12
|
+
Date: InternalHandler<Date>;
|
|
13
|
+
Error: InternalHandler<Error>;
|
|
14
|
+
Float32Array: InternalHandler<Float32Array>;
|
|
15
|
+
Float64Array: InternalHandler<Float64Array>;
|
|
16
|
+
Int8Array: InternalHandler<Int8Array>;
|
|
17
|
+
Int16Array: InternalHandler<Int16Array>;
|
|
18
|
+
Int32Array: InternalHandler<Int32Array>;
|
|
19
|
+
Map: InternalHandler<Map<unknown, unknown>>;
|
|
20
|
+
Object: InternalHandler<Record<string, unknown>>;
|
|
21
|
+
Promise: InternalHandler<Promise<unknown>>;
|
|
22
|
+
RegExp: InternalHandler<RegExp>;
|
|
23
|
+
Set: InternalHandler<Set<unknown>>;
|
|
24
|
+
WeakMap: InternalHandler<WeakMap<any, unknown>>;
|
|
25
|
+
WeakSet: InternalHandler<WeakSet<any>>;
|
|
26
|
+
};
|
|
27
|
+
strict?: boolean;
|
|
28
|
+
};
|
|
29
|
+
type TypedArray = BigInt64Array | BigUint64Array | Float32Array | Float64Array | Int8Array | Int16Array | Int32Array | Uint8Array | Uint8ClampedArray | Uint16Array | Uint32Array;
|
|
30
|
+
|
|
31
|
+
export type { Options as O, State as S, TypedArray as T };
|
package/dist/utils.cjs
CHANGED
|
@@ -1,16 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var chunkULIBPEBE_cjs = require('./chunk-ULIBPEBE.cjs');
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
Object.defineProperty(exports, 'copyOwnProperties', {
|
|
8
|
-
enumerable: true,
|
|
9
|
-
get: function () { return chunkULIBPEBE_cjs.a; }
|
|
10
|
-
});
|
|
11
|
-
Object.defineProperty(exports, 'getCleanClone', {
|
|
12
|
-
enumerable: true,
|
|
13
|
-
get: function () { return chunkULIBPEBE_cjs.b; }
|
|
14
|
-
});
|
|
15
|
-
//# sourceMappingURL=out.js.map
|
|
16
|
-
//# sourceMappingURL=utils.cjs.map
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./packem_shared/copyOwnProperties-Zk6Vg6Oe.cjs"),o=require("./packem_shared/getCleanClone-DLZ_E9xd.cjs");exports.copyOwnProperties=e;exports.getCleanClone=o;
|
package/dist/utils.d.cts
CHANGED
package/dist/utils.d.mts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { S as State } from './packem_shared/types-_Qve7nv8.mjs';
|
|
2
|
+
|
|
3
|
+
declare const copyOwnProperties: <Value>(value: Value, clone: Value, state: State) => Value;
|
|
4
|
+
|
|
5
|
+
declare const getCleanClone: (input: unknown) => any;
|
|
6
|
+
|
|
7
|
+
export { copyOwnProperties, getCleanClone };
|
package/dist/utils.d.ts
CHANGED
package/dist/utils.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{default as r}from"./packem_shared/copyOwnProperties-QEhjt2x8.mjs";import{default as a}from"./packem_shared/getCleanClone-D0FN9QGR.mjs";export{r as copyOwnProperties,a as getCleanClone};
|
package/package.json
CHANGED
|
@@ -1,191 +1,202 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
2
|
+
"name": "@visulima/deep-clone",
|
|
3
|
+
"version": "2.1.4",
|
|
4
|
+
"description": "Fastest deep clone implementation.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"anolilab",
|
|
7
|
+
"clone",
|
|
8
|
+
"clone-deep",
|
|
9
|
+
"copy",
|
|
10
|
+
"deep",
|
|
11
|
+
"deep-clone",
|
|
12
|
+
"deep-copy",
|
|
13
|
+
"deepclone",
|
|
14
|
+
"deepcopy",
|
|
15
|
+
"fast",
|
|
16
|
+
"fast-clone",
|
|
17
|
+
"fast-copy",
|
|
18
|
+
"fast-deep-clone",
|
|
19
|
+
"fast-deep-copy",
|
|
20
|
+
"fastclone",
|
|
21
|
+
"fastcopy",
|
|
22
|
+
"fastest-json-copy",
|
|
23
|
+
"key",
|
|
24
|
+
"keys",
|
|
25
|
+
"lodash.clonedeep",
|
|
26
|
+
"nano-copy",
|
|
27
|
+
"obj",
|
|
28
|
+
"object",
|
|
29
|
+
"performance",
|
|
30
|
+
"performant",
|
|
31
|
+
"plain-object-clone",
|
|
32
|
+
"prop",
|
|
33
|
+
"properties",
|
|
34
|
+
"ramda",
|
|
35
|
+
"recursive",
|
|
36
|
+
"standard",
|
|
37
|
+
"values",
|
|
38
|
+
"visulima"
|
|
39
|
+
],
|
|
40
|
+
"homepage": "https://www.visulima.com/docs/package/deep-clone",
|
|
41
|
+
"repository": {
|
|
42
|
+
"type": "git",
|
|
43
|
+
"url": "https://github.com/visulima/visulima.git",
|
|
44
|
+
"directory": "packages/deep-clone"
|
|
45
|
+
},
|
|
46
|
+
"funding": [
|
|
47
|
+
{
|
|
48
|
+
"type": "github",
|
|
49
|
+
"url": "https://github.com/sponsors/prisis"
|
|
45
50
|
},
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
51
|
+
{
|
|
52
|
+
"type": "consulting",
|
|
53
|
+
"url": "https://anolilab.com/support"
|
|
54
|
+
}
|
|
55
|
+
],
|
|
56
|
+
"license": "MIT",
|
|
57
|
+
"author": {
|
|
58
|
+
"name": "Daniel Bannert",
|
|
59
|
+
"email": "d.bannert@anolilab.de"
|
|
60
|
+
},
|
|
61
|
+
"sideEffects": false,
|
|
62
|
+
"type": "module",
|
|
63
|
+
"exports": {
|
|
64
|
+
".": {
|
|
65
|
+
"require": {
|
|
66
|
+
"types": "./dist/index.d.cts",
|
|
67
|
+
"default": "./dist/index.cjs"
|
|
68
|
+
},
|
|
69
|
+
"import": {
|
|
70
|
+
"types": "./dist/index.d.mts",
|
|
71
|
+
"default": "./dist/index.mjs"
|
|
72
|
+
}
|
|
60
73
|
},
|
|
61
|
-
"
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
"
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
"types": "./dist/index.d.ts",
|
|
71
|
-
"default": "./dist/index.js"
|
|
72
|
-
}
|
|
73
|
-
},
|
|
74
|
-
"./handler": {
|
|
75
|
-
"require": {
|
|
76
|
-
"types": "./dist/handler.d.cts",
|
|
77
|
-
"default": "./dist/handler.cjs"
|
|
78
|
-
},
|
|
79
|
-
"import": {
|
|
80
|
-
"types": "./dist/handler.d.ts",
|
|
81
|
-
"default": "./dist/handler.js"
|
|
82
|
-
}
|
|
83
|
-
},
|
|
84
|
-
"./utils": {
|
|
85
|
-
"require": {
|
|
86
|
-
"types": "./dist/utils.d.cts",
|
|
87
|
-
"default": "./dist/utils.cjs"
|
|
88
|
-
},
|
|
89
|
-
"import": {
|
|
90
|
-
"types": "./dist/utils.d.ts",
|
|
91
|
-
"default": "./dist/utils.js"
|
|
92
|
-
}
|
|
93
|
-
},
|
|
94
|
-
"./package.json": "./package.json"
|
|
74
|
+
"./handler": {
|
|
75
|
+
"require": {
|
|
76
|
+
"types": "./dist/handler.d.cts",
|
|
77
|
+
"default": "./dist/handler.cjs"
|
|
78
|
+
},
|
|
79
|
+
"import": {
|
|
80
|
+
"types": "./dist/handler.d.mts",
|
|
81
|
+
"default": "./dist/handler.mjs"
|
|
82
|
+
}
|
|
95
83
|
},
|
|
96
|
-
"
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
"
|
|
103
|
-
"
|
|
104
|
-
|
|
105
|
-
"scripts": {
|
|
106
|
-
"build": "cross-env NODE_ENV=development tsup",
|
|
107
|
-
"build:prod": "cross-env NODE_ENV=production tsup",
|
|
108
|
-
"clean": "rimraf node_modules dist .eslintcache",
|
|
109
|
-
"dev": "pnpm run build --watch",
|
|
110
|
-
"lint:eslint": "eslint . --ext js,cjs,mjs,jsx,ts,tsx,json,yaml,yml,md,mdx --max-warnings=0 --config .eslintrc.cjs",
|
|
111
|
-
"lint:eslint:fix": "pnpm run lint:eslint --fix",
|
|
112
|
-
"lint:packagejson": "publint --strict",
|
|
113
|
-
"lint:prettier": "prettier --config=.prettierrc.cjs --check .",
|
|
114
|
-
"lint:prettier:fix": "prettier --config=.prettierrc.cjs --write .",
|
|
115
|
-
"lint:types": "tsc --noEmit",
|
|
116
|
-
"test": "vitest run",
|
|
117
|
-
"test:bench": "vitest bench",
|
|
118
|
-
"test:coverage": "vitest run --coverage",
|
|
119
|
-
"test:ui": "vitest --ui --coverage.enabled=true",
|
|
120
|
-
"test:watch": "vitest"
|
|
84
|
+
"./utils": {
|
|
85
|
+
"require": {
|
|
86
|
+
"types": "./dist/utils.d.cts",
|
|
87
|
+
"default": "./dist/utils.cjs"
|
|
88
|
+
},
|
|
89
|
+
"import": {
|
|
90
|
+
"types": "./dist/utils.d.mts",
|
|
91
|
+
"default": "./dist/utils.mjs"
|
|
92
|
+
}
|
|
121
93
|
},
|
|
122
|
-
"
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
"
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
"
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
"
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
"
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
"
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
"
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
"
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
"
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
}
|
|
94
|
+
"./package.json": "./package.json"
|
|
95
|
+
},
|
|
96
|
+
"main": "dist/index.cjs",
|
|
97
|
+
"module": "dist/index.mjs",
|
|
98
|
+
"types": "dist/index.d.ts",
|
|
99
|
+
"typesVersions": {
|
|
100
|
+
">=5.0": {
|
|
101
|
+
".": [
|
|
102
|
+
"./dist/index.d.ts"
|
|
103
|
+
],
|
|
104
|
+
"handler": [
|
|
105
|
+
"./dist/handler.d.ts"
|
|
106
|
+
],
|
|
107
|
+
"utils": [
|
|
108
|
+
"./dist/utils.d.ts"
|
|
109
|
+
]
|
|
110
|
+
}
|
|
111
|
+
},
|
|
112
|
+
"files": [
|
|
113
|
+
"dist/**",
|
|
114
|
+
"README.md",
|
|
115
|
+
"CHANGELOG.md",
|
|
116
|
+
"LICENSE.md"
|
|
117
|
+
],
|
|
118
|
+
"devDependencies": {
|
|
119
|
+
"@anolilab/eslint-config": "^15.0.3",
|
|
120
|
+
"@anolilab/prettier-config": "^5.0.14",
|
|
121
|
+
"@anolilab/semantic-release-pnpm": "^1.1.3",
|
|
122
|
+
"@anolilab/semantic-release-preset": "^9.0.0",
|
|
123
|
+
"@arethetypeswrong/cli": "^0.16.2",
|
|
124
|
+
"@mfederczuk/deeptools": "2.1.0-indev01",
|
|
125
|
+
"@rushstack/eslint-plugin-security": "^0.8.2",
|
|
126
|
+
"@total-typescript/ts-reset": "^0.6.1",
|
|
127
|
+
"@types/lodash.clonedeep": "^4.5.9",
|
|
128
|
+
"@types/node": "18.19.15",
|
|
129
|
+
"@ungap/structured-clone": "^1.2.0",
|
|
130
|
+
"@visulima/packem": "^1.0.0-alpha.108",
|
|
131
|
+
"@vitest/coverage-v8": "^2.0.5",
|
|
132
|
+
"@vitest/ui": "^2.0.5",
|
|
133
|
+
"clone-deep": "^4.0.1",
|
|
134
|
+
"conventional-changelog-conventionalcommits": "8.0.0",
|
|
135
|
+
"cross-env": "^7.0.3",
|
|
136
|
+
"deep-copy": "^1.4.2",
|
|
137
|
+
"esbuild": "0.23.0",
|
|
138
|
+
"eslint": "8.57.0",
|
|
139
|
+
"eslint-plugin-deprecation": "^3.0.0",
|
|
140
|
+
"eslint-plugin-etc": "^2.0.3",
|
|
141
|
+
"eslint-plugin-import": "npm:eslint-plugin-i@^2.29.1",
|
|
142
|
+
"eslint-plugin-mdx": "^3.1.5",
|
|
143
|
+
"eslint-plugin-tsdoc": "^0.3.0",
|
|
144
|
+
"eslint-plugin-vitest": "^0.4.1",
|
|
145
|
+
"eslint-plugin-vitest-globals": "^1.5.0",
|
|
146
|
+
"fast-copy": "^3.0.2",
|
|
147
|
+
"jsdom": "^25.0.0",
|
|
148
|
+
"lodash.clonedeep": "^4.5.0",
|
|
149
|
+
"nano-copy": "^0.1.0",
|
|
150
|
+
"nanoclone": "^1.0.2",
|
|
151
|
+
"plain-object-clone": "^2.0.0",
|
|
152
|
+
"prettier": "^3.3.3",
|
|
153
|
+
"ramda": "^0.30.1",
|
|
154
|
+
"rfdc": "^1.4.1",
|
|
155
|
+
"rimraf": "5.0.9",
|
|
156
|
+
"semantic-release": "24.0.0",
|
|
157
|
+
"standard": "^17.1.0",
|
|
158
|
+
"typescript": "5.4.5",
|
|
159
|
+
"vitest": "^2.0.5"
|
|
160
|
+
},
|
|
161
|
+
"engines": {
|
|
162
|
+
"node": ">=18.* <=22.*"
|
|
163
|
+
},
|
|
164
|
+
"os": [
|
|
165
|
+
"darwin",
|
|
166
|
+
"linux",
|
|
167
|
+
"win32"
|
|
168
|
+
],
|
|
169
|
+
"publishConfig": {
|
|
170
|
+
"access": "public",
|
|
171
|
+
"provenance": true
|
|
172
|
+
},
|
|
173
|
+
"anolilab": {
|
|
174
|
+
"eslint-config": {
|
|
175
|
+
"plugin": {
|
|
176
|
+
"tsdoc": false
|
|
177
|
+
},
|
|
178
|
+
"warn_on_unsupported_typescript_version": false,
|
|
179
|
+
"info_on_disabling_jsx_react_rule": false,
|
|
180
|
+
"info_on_disabling_prettier_conflict_rule": false,
|
|
181
|
+
"info_on_disabling_jsonc_sort_keys_rule": false,
|
|
182
|
+
"info_on_disabling_etc_no_deprecated": false
|
|
183
|
+
}
|
|
184
|
+
},
|
|
185
|
+
"scripts": {
|
|
186
|
+
"build": "cross-env NODE_ENV=development packem build",
|
|
187
|
+
"build:prod": "cross-env NODE_ENV=production packem build",
|
|
188
|
+
"clean": "rimraf node_modules dist .eslintcache",
|
|
189
|
+
"dev": "pnpm run build --watch",
|
|
190
|
+
"lint:attw": "attw --pack",
|
|
191
|
+
"lint:eslint": "eslint . --ext js,cjs,mjs,jsx,ts,tsx,json,yaml,yml,md,mdx --max-warnings=0 --config .eslintrc.cjs",
|
|
192
|
+
"lint:eslint:fix": "eslint . --ext js,cjs,mjs,jsx,ts,tsx,json,yaml,yml,md,mdx --max-warnings=0 --config .eslintrc.cjs --fix",
|
|
193
|
+
"lint:package-json": "publint --strict",
|
|
194
|
+
"lint:prettier": "prettier --config=.prettierrc.cjs --check .",
|
|
195
|
+
"lint:prettier:fix": "prettier --config=.prettierrc.cjs --write .",
|
|
196
|
+
"lint:types": "tsc --noEmit",
|
|
197
|
+
"test": "vitest run",
|
|
198
|
+
"test:coverage": "vitest run --coverage",
|
|
199
|
+
"test:ui": "vitest --ui --coverage.enabled=true",
|
|
200
|
+
"test:watch": "vitest"
|
|
201
|
+
}
|
|
202
|
+
}
|
package/dist/chunk-L5LW2LUR.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { a, b as b$1 } from './chunk-LPGIVFCB.js';
|
|
2
|
-
|
|
3
|
-
var w=(e,r)=>{let t=[];r.cache.set(e,t);for(let n=0,{length:o}=e;n<o;++n)t[n]=r.clone(e[n],r);return t},S=(e,r)=>{let t=[];return r.cache.set(e,t),a(e,t,r)};var y=e=>{let r={BigInt64Array,BigUint64Array,Buffer:Buffer.from,Float32Array,Float64Array,Int8Array,Int16Array,Int32Array,Uint8Array,Uint8ClampedArray,Uint16Array,Uint32Array};if(e instanceof ArrayBuffer){let n=new ArrayBuffer(e.byteLength),o=new Uint8Array(e);return new Uint8Array(n).set(o),n}let t=r[e.constructor.name]??void 0;return t?new t(e):new e.constructor([...e.buffer],e.byteOffset,e.length)},u=y;var V=e=>e.slice(0,e.size,e.type),g=V;var i=e=>new DataView(u(e.buffer)),P=i;var d=e=>new Date(e.getTime()),b=d;var f=(e,r)=>{let t=new e.constructor(e.message);return e.stack&&(t.stack=e.stack),e.code&&(t.code=e.code),e.errno&&(t.errno=e.errno),e.syscall&&(t.syscall=e.syscall),a(e,t,r)},B=f;var x=(e,r)=>{let t=new Map;return r.cache.set(e,t),e.forEach((n,o)=>{t.set(o,r.clone(n,r));}),t},L=(e,r)=>a(e,x(e,r),r);var p=(e,r)=>{Object.isExtensible(e)||Object.preventExtensions(r),Object.isSealed(e)&&Object.seal(r),Object.isFrozen(e)&&Object.freeze(r);},F=(e,r)=>{let t=b$1(e);r.cache.set(e,t);for(let o in e)Object.hasOwnProperty.call(e,o)&&(t[o]=r.clone(e[o],r));let n=Object.getOwnPropertySymbols(e);for(let o=0,{length:c}=n,s;o<c;++o)s=n[o],Object.prototype.propertyIsEnumerable.call(e,s)&&(t[s]=r.clone(e[s],r));return p(e,t),t},z=(e,r)=>{let t=b$1(e);r.cache.set(e,t);let n=a(e,t,r),o=Object.getPrototypeOf(e);return Object.getPrototypeOf(n)!==o&&Object.setPrototypeOf(n,o),p(e,t),n};var H=e=>{let r=new RegExp(e.source,e.flags);return r.lastIndex=e.lastIndex,r},G=(e,r)=>{let t=new RegExp(e.source,e.flags);return a(e,t,r)};var E=(e,r)=>{let t=new Set;return r.cache.set(e,t),e.forEach(n=>{t.add(r.clone(n,r));}),t},Q=(e,r)=>a(e,E(e,r),r);
|
|
4
|
-
|
|
5
|
-
export { w as a, S as b, u as c, g as d, P as e, b as f, B as g, x as h, L as i, F as j, z as k, H as l, G as m, E as n, Q as o };
|
|
6
|
-
//# sourceMappingURL=out.js.map
|
|
7
|
-
//# sourceMappingURL=chunk-L5LW2LUR.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/handler/copy-array.ts","../src/handler/copy-array-buffer.ts","../src/handler/copy-blob.ts","../src/handler/copy-data-view.ts","../src/handler/copy-date.ts","../src/handler/copy-error.ts","../src/handler/copy-map.ts","../src/handler/copy-object.ts","../src/handler/copy-regexp.ts","../src/handler/copy-set.ts"],"names":["copyArrayLoose","array","state","clone","index","length","copyArrayStrict","copy_own_properties_default","copyArrayBuffer","arrayBuffer","typeHandlers","newBuffer","origView","Ctor","copy_array_buffer_default","copyBlob","blob","copy_blob_default","copyDataView","dataView","copy_data_view_default","copyDate","date","copy_date_default","copyError","object","error","copy_error_default","copyMapLoose","map","value","key","copyMapStrict","copyObjectIsFunctions","copyObjectLoose","get_clean_clone_default","symbols","symbol","copyObjectStrict","clonedObject","objectPrototype","copyRegExpLoose","regExp","copyRegExpStrict","copySetLoose","set","copySetStrict"],"mappings":"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","sourcesContent":["import type { State } from \"../types\";\nimport copyOwnProperties from \"../utils/copy-own-properties\";\n\nexport const copyArrayLoose = <Value extends unknown[]>(array: Value, state: State): Value => {\n const clone: Value = [] as unknown as Value;\n\n // set in the cache immediately to be able to reuse the object recursively\n state.cache.set(array, clone);\n\n // eslint-disable-next-line no-loops/no-loops,no-plusplus\n for (let index = 0, { length } = array; index < length; ++index) {\n clone[index] = state.clone(array[index], state);\n }\n\n return clone;\n};\n\n/**\n * Deeply copy the indexed values in the array, as well as any custom properties.\n */\nexport const copyArrayStrict = <Value extends unknown[]>(array: Value, state: State): Value => {\n const clone: Value = [] as unknown as Value;\n\n // set in the cache immediately to be able to reuse the object recursively\n state.cache.set(array, clone);\n\n return copyOwnProperties(array, clone, state);\n};\n","import type { TypedArray } from \"../types\";\n\nconst copyArrayBuffer = <Value extends ArrayBuffer | ArrayBufferView | Buffer | TypedArray>(arrayBuffer: Value): Value => {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const typeHandlers: Record<string, new (buffer: any) => any> = {\n BigInt64Array,\n BigUint64Array,\n // @ts-expect-error - Buffer has no constructor\n // eslint-disable-next-line @typescript-eslint/unbound-method\n Buffer: Buffer.from,\n Float32Array,\n Float64Array,\n Int8Array,\n Int16Array,\n Int32Array,\n Uint8Array,\n Uint8ClampedArray,\n Uint16Array,\n Uint32Array,\n };\n\n if (arrayBuffer instanceof ArrayBuffer) {\n const newBuffer = new ArrayBuffer(arrayBuffer.byteLength);\n const origView = new Uint8Array(arrayBuffer);\n const newView = new Uint8Array(newBuffer);\n\n newView.set(origView);\n\n return newBuffer as Value;\n }\n\n const Ctor = typeHandlers[arrayBuffer.constructor.name] ?? undefined;\n\n if (Ctor) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return\n return new Ctor(arrayBuffer);\n }\n\n // @ts-expect-error - Fallback to ArrayBufferView\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return\n return new (arrayBuffer as ArrayBufferView).constructor([...arrayBuffer.buffer], arrayBuffer.byteOffset, arrayBuffer.length);\n};\n\nexport default copyArrayBuffer;\n","const copyBlob = <Value extends Blob>(blob: Value): Value => blob.slice(0, blob.size, blob.type) as Value;\n\nexport default copyBlob;\n","import copyArrayBuffer from \"./copy-array-buffer\";\n\nconst copyDataView = <Value extends DataView>(dataView: Value): Value => new DataView(copyArrayBuffer(dataView.buffer)) as Value;\n\nexport default copyDataView;\n","const copyDate = <Value extends Date>(date: Value): Value => new Date(date.getTime()) as Value;\n\nexport default copyDate;\n","import type { State } from \"../types\";\nimport copyOwnProperties from \"../utils/copy-own-properties\";\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype ExtendedError = Error & { code?: any; errno?: any; syscall?: any };\n\nconst copyError = <Value extends EvalError | ExtendedError | RangeError | ReferenceError | SyntaxError | TypeError | URIError>(\n object: Value,\n state: State,\n): Value => {\n // @ts-expect-error - We don't know the type of the object, can be an error\n const error = new object.constructor(object.message) as EvalError | ExtendedError | RangeError | ReferenceError | SyntaxError | TypeError | URIError;\n\n // If a `stack` property is present, copy it over...\n if (object.stack) {\n error.stack = object.stack;\n }\n\n // Node.js specific (system errors)...\n if ((object as ExtendedError).code) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n (error as ExtendedError).code = (object as ExtendedError).code;\n }\n\n if ((object as ExtendedError).errno) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n (error as ExtendedError).errno = (object as ExtendedError).errno;\n }\n\n if ((object as ExtendedError).syscall) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n (error as ExtendedError).syscall = (object as ExtendedError).syscall;\n }\n\n return copyOwnProperties(object, error, state) as Value;\n};\n\nexport default copyError;\n","import type { State } from \"../types\";\nimport copyOwnProperties from \"../utils/copy-own-properties\";\n\nexport const copyMapLoose = <Value extends Map<unknown, unknown>>(map: Value, state: State): Value => {\n const clone = new Map() as Value;\n\n // set in the cache immediately to be able to reuse the object recursively\n state.cache.set(map, clone);\n\n map.forEach((value, key) => {\n clone.set(key, state.clone(value, state));\n });\n\n return clone;\n};\n\n/**\n * Deeply copy the keys and values of the original, as well as any custom properties.\n */\nexport const copyMapStrict = <Value extends Map<unknown, unknown>>(map: Value, state: State): Value =>\n copyOwnProperties(map, copyMapLoose<Value>(map, state), state);\n","import type { State } from \"../types\";\nimport copyOwnProperties from \"../utils/copy-own-properties\";\nimport getCleanClone from \"../utils/get-clean-clone\";\n\ndeclare const emptyObjectSymbol: unique symbol;\n\nconst copyObjectIsFunctions = <Value extends Record<PropertyKey, unknown>>(object: Value, clone: Value): void => {\n if (!Object.isExtensible(object)) {\n Object.preventExtensions(clone);\n }\n\n if (Object.isSealed(object)) {\n Object.seal(clone);\n }\n\n if (Object.isFrozen(object)) {\n Object.freeze(clone);\n }\n};\n\nexport const copyObjectLoose = <Value extends Record<PropertyKey, unknown>>(object: Value, state: State): Value => {\n const clone = getCleanClone(object) as { [emptyObjectSymbol]?: never };\n\n // set in the cache immediately to be able to reuse the object recursively\n state.cache.set(object, clone);\n\n // eslint-disable-next-line no-loops/no-loops,no-restricted-syntax\n for (const key in object) {\n if (Object.hasOwnProperty.call(object, key)) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-explicit-any\n (clone as any)[key] = state.clone(object[key], state);\n }\n }\n\n const symbols = Object.getOwnPropertySymbols(object);\n\n // eslint-disable-next-line no-loops/no-loops,no-plusplus\n for (let index = 0, { length } = symbols, symbol; index < length; ++index) {\n symbol = symbols[index] as symbol;\n\n if (Object.prototype.propertyIsEnumerable.call(object, symbol)) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-explicit-any\n (clone as any)[symbol] = state.clone((object as any)[symbol], state);\n }\n }\n\n copyObjectIsFunctions(object, clone as Value);\n\n return clone as Value;\n};\n\n/**\n * Deeply copy the properties (keys and symbols) and values of the original, as well\n * as any hidden or non-enumerable properties.\n */\nexport const copyObjectStrict = <Value extends Record<PropertyKey, unknown>>(object: Value, state: State): Value => {\n const clone = getCleanClone(object) as { [emptyObjectSymbol]?: never };\n\n // set in the cache immediately to be able to reuse the object recursively\n state.cache.set(object, clone);\n\n const clonedObject = copyOwnProperties<Value>(object, clone as Value, state);\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const objectPrototype: object | null = Object.getPrototypeOf(object);\n\n if (Object.getPrototypeOf(clonedObject) !== objectPrototype) {\n Object.setPrototypeOf(clonedObject, objectPrototype);\n }\n\n copyObjectIsFunctions(object, clone as Value);\n\n return clonedObject as Value;\n};\n","import type { State } from \"../types\";\nimport copyOwnProperties from \"../utils/copy-own-properties\";\n\nexport const copyRegExpLoose = <Value extends RegExp>(regExp: Value): Value => {\n // eslint-disable-next-line @rushstack/security/no-unsafe-regexp,security/detect-non-literal-regexp\n const clone = new RegExp(regExp.source, regExp.flags) as Value;\n\n clone.lastIndex = regExp.lastIndex;\n\n return clone;\n};\n\nexport const copyRegExpStrict = <Value extends RegExp>(regExp: Value, state: State): Value => {\n // eslint-disable-next-line @rushstack/security/no-unsafe-regexp,security/detect-non-literal-regexp\n const clone = new RegExp(regExp.source, regExp.flags) as Value;\n\n return copyOwnProperties(regExp, clone, state);\n};\n","import type { State } from \"../types\";\nimport copyOwnProperties from \"../utils/copy-own-properties\";\n\nexport const copySetLoose = <Value extends Set<unknown>>(set: Value, state: State): Value => {\n const clone = new Set() as Value;\n\n // set in the cache immediately to be able to reuse the object recursively\n state.cache.set(set, clone);\n\n set.forEach((value) => {\n clone.add(state.clone(value, state));\n });\n\n return clone;\n};\n\n/**\n * Deeply copy the values of the original, as well as any custom properties.\n */\nexport const copySetStrict = <Value extends Set<unknown>>(set: Value, state: State): Value => copyOwnProperties(set, copySetLoose<Value>(set, state), state);\n"]}
|
package/dist/chunk-LPGIVFCB.js
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
var a=e=>[...Object.getOwnPropertyNames(e),...Object.getOwnPropertySymbols(e)],s=(e,t,n)=>{let c=a(e);for(let r of c){if(r==="callee"||r==="caller")continue;let o=Object.getOwnPropertyDescriptor(e,r);if(!o){t[r]=n.clone(e[r],n);continue}!o.get&&!o.set&&(o.value=n.clone(o.value,n));try{Object.defineProperty(t,r,o);}catch{t[r]=o.value;}}return t},y=s;var l=e=>{if(!e)return Object.create(null);let t=e.constructor;if(t===Object)return e===Object.prototype?{}:Object.create(e);if(~Function.prototype.toString.call(t).indexOf("[native code]"))try{return new t}catch{}return Object.create(e)},p=l;
|
|
2
|
-
|
|
3
|
-
export { y as a, p as b };
|
|
4
|
-
//# sourceMappingURL=out.js.map
|
|
5
|
-
//# sourceMappingURL=chunk-LPGIVFCB.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/utils/copy-own-properties.ts","../src/utils/get-clean-clone.ts"],"names":["getStrictProperties","object","copyOwnProperties","value","clone","state","properties","property","descriptor","copy_own_properties_default","getCleanClone","input","Constructor","get_clean_clone_default"],"mappings":"AAEA,IAAMA,EAAuBC,GAAyC,CAClE,GAAI,OAAO,oBAAoBA,CAAM,EACrC,GAAG,OAAO,sBAAsBA,CAAM,CAC1C,EAKMC,EAAoB,CAAQC,EAAcC,EAAcC,IAAwB,CAClF,IAAMC,EAAaN,EAAoBG,CAAK,EAG5C,QAAWI,KAAYD,EAAY,CAC/B,GAAIC,IAAa,UAAYA,IAAa,SAEtC,SAGJ,IAAMC,EAAa,OAAO,yBAAyBL,EAAOI,CAAQ,EAElE,GAAI,CAACC,EAAY,CAKZJ,EAAcG,CAAQ,EAAIF,EAAM,MAAOF,EAAcI,CAAQ,EAAGF,CAAK,EAEtE,QACJ,CAGI,CAACG,EAAW,KAAO,CAACA,EAAW,MAC/BA,EAAW,MAAQH,EAAM,MAAMG,EAAW,MAAOH,CAAK,GAG1D,GAAI,CACA,OAAO,eAAeD,EAAOG,EAAUC,CAAU,CACrD,MAAQ,CAGHJ,EAAcG,CAAQ,EAAIC,EAAW,KAC1C,CACJ,CAEA,OAAOJ,CACX,EAEOK,EAAQP,EC7Cf,IAAMQ,EAAiBC,GAAwB,CAC3C,GAAI,CAACA,EACD,OAAO,OAAO,OAAO,IAAI,EAG7B,IAAMC,EAAcD,EAAM,YAE1B,GAAIC,IAAgB,OAChB,OAAOD,IAAU,OAAO,UAAY,CAAC,EAAI,OAAO,OAAOA,CAAK,EAIhE,GAAI,CAAC,SAAS,UAAU,SAAS,KAAKC,CAAW,EAAE,QAAQ,eAAe,EACtE,GAAI,CAEA,OAAO,IAAIA,CACf,MAAQ,CAER,CAGJ,OAAO,OAAO,OAAOD,CAAK,CAC9B,EAEOE,EAAQH","sourcesContent":["import type { State } from \"../types\";\n\nconst getStrictProperties = (object: unknown): (string | symbol)[] => [\n ...(Object.getOwnPropertyNames(object) as (string | symbol)[]),\n ...Object.getOwnPropertySymbols(object),\n];\n\n/**\n * Strict copy all properties contained on the object.\n */\nconst copyOwnProperties = <Value>(value: Value, clone: Value, state: State): Value => {\n const properties = getStrictProperties(value);\n\n // eslint-disable-next-line no-loops/no-loops,no-restricted-syntax\n for (const property of properties) {\n if (property === \"callee\" || property === \"caller\") {\n // eslint-disable-next-line no-continue\n continue;\n }\n\n const descriptor = Object.getOwnPropertyDescriptor(value, property);\n\n if (!descriptor) {\n // In extra edge cases where the property descriptor cannot be retrived, fall back to\n // the loose assignment.\n\n // eslint-disable-next-line no-param-reassign,@typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-explicit-any\n (clone as any)[property] = state.clone((value as any)[property], state);\n // eslint-disable-next-line no-continue\n continue;\n }\n\n // Only clone the value if actually a value, not a getter / setter.\n if (!descriptor.get && !descriptor.set) {\n descriptor.value = state.clone(descriptor.value, state);\n }\n\n try {\n Object.defineProperty(clone, property, descriptor);\n } catch {\n // Tee above can fail on node in edge cases, so fall back to the loose assignment.\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment,no-param-reassign,@typescript-eslint/no-explicit-any,@typescript-eslint/no-unsafe-member-access\n (clone as any)[property] = descriptor.value;\n }\n }\n\n return clone;\n};\n\nexport default copyOwnProperties;\n","/**\n * Get an empty version of the object with the same prototype it has.\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst getCleanClone = (input: unknown): any => {\n if (!input) {\n return Object.create(null);\n }\n\n const Constructor = input.constructor;\n\n if (Constructor === Object) {\n return input === Object.prototype ? {} : Object.create(input);\n }\n\n // eslint-disable-next-line no-bitwise\n if (~Function.prototype.toString.call(Constructor).indexOf(\"[native code]\")) {\n try {\n // @ts-expect-error - We don't know the type of the object, can be a function\n return new Constructor();\n } catch {\n /* empty */\n }\n }\n\n return Object.create(input);\n};\n\nexport default getCleanClone;\n"]}
|
package/dist/chunk-ULIBPEBE.cjs
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var a=e=>[...Object.getOwnPropertyNames(e),...Object.getOwnPropertySymbols(e)],s=(e,t,n)=>{let c=a(e);for(let r of c){if(r==="callee"||r==="caller")continue;let o=Object.getOwnPropertyDescriptor(e,r);if(!o){t[r]=n.clone(e[r],n);continue}!o.get&&!o.set&&(o.value=n.clone(o.value,n));try{Object.defineProperty(t,r,o);}catch{t[r]=o.value;}}return t},y=s;var l=e=>{if(!e)return Object.create(null);let t=e.constructor;if(t===Object)return e===Object.prototype?{}:Object.create(e);if(~Function.prototype.toString.call(t).indexOf("[native code]"))try{return new t}catch{}return Object.create(e)},p=l;
|
|
4
|
-
|
|
5
|
-
exports.a = y;
|
|
6
|
-
exports.b = p;
|
|
7
|
-
//# sourceMappingURL=out.js.map
|
|
8
|
-
//# sourceMappingURL=chunk-ULIBPEBE.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/utils/copy-own-properties.ts","../src/utils/get-clean-clone.ts"],"names":["getStrictProperties","object","copyOwnProperties","value","clone","state","properties","property","descriptor","copy_own_properties_default","getCleanClone","input","Constructor","get_clean_clone_default"],"mappings":"AAEA,IAAMA,EAAuBC,GAAyC,CAClE,GAAI,OAAO,oBAAoBA,CAAM,EACrC,GAAG,OAAO,sBAAsBA,CAAM,CAC1C,EAKMC,EAAoB,CAAQC,EAAcC,EAAcC,IAAwB,CAClF,IAAMC,EAAaN,EAAoBG,CAAK,EAG5C,QAAWI,KAAYD,EAAY,CAC/B,GAAIC,IAAa,UAAYA,IAAa,SAEtC,SAGJ,IAAMC,EAAa,OAAO,yBAAyBL,EAAOI,CAAQ,EAElE,GAAI,CAACC,EAAY,CAKZJ,EAAcG,CAAQ,EAAIF,EAAM,MAAOF,EAAcI,CAAQ,EAAGF,CAAK,EAEtE,QACJ,CAGI,CAACG,EAAW,KAAO,CAACA,EAAW,MAC/BA,EAAW,MAAQH,EAAM,MAAMG,EAAW,MAAOH,CAAK,GAG1D,GAAI,CACA,OAAO,eAAeD,EAAOG,EAAUC,CAAU,CACrD,MAAQ,CAGHJ,EAAcG,CAAQ,EAAIC,EAAW,KAC1C,CACJ,CAEA,OAAOJ,CACX,EAEOK,EAAQP,EC7Cf,IAAMQ,EAAiBC,GAAwB,CAC3C,GAAI,CAACA,EACD,OAAO,OAAO,OAAO,IAAI,EAG7B,IAAMC,EAAcD,EAAM,YAE1B,GAAIC,IAAgB,OAChB,OAAOD,IAAU,OAAO,UAAY,CAAC,EAAI,OAAO,OAAOA,CAAK,EAIhE,GAAI,CAAC,SAAS,UAAU,SAAS,KAAKC,CAAW,EAAE,QAAQ,eAAe,EACtE,GAAI,CAEA,OAAO,IAAIA,CACf,MAAQ,CAER,CAGJ,OAAO,OAAO,OAAOD,CAAK,CAC9B,EAEOE,EAAQH","sourcesContent":["import type { State } from \"../types\";\n\nconst getStrictProperties = (object: unknown): (string | symbol)[] => [\n ...(Object.getOwnPropertyNames(object) as (string | symbol)[]),\n ...Object.getOwnPropertySymbols(object),\n];\n\n/**\n * Strict copy all properties contained on the object.\n */\nconst copyOwnProperties = <Value>(value: Value, clone: Value, state: State): Value => {\n const properties = getStrictProperties(value);\n\n // eslint-disable-next-line no-loops/no-loops,no-restricted-syntax\n for (const property of properties) {\n if (property === \"callee\" || property === \"caller\") {\n // eslint-disable-next-line no-continue\n continue;\n }\n\n const descriptor = Object.getOwnPropertyDescriptor(value, property);\n\n if (!descriptor) {\n // In extra edge cases where the property descriptor cannot be retrived, fall back to\n // the loose assignment.\n\n // eslint-disable-next-line no-param-reassign,@typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-explicit-any\n (clone as any)[property] = state.clone((value as any)[property], state);\n // eslint-disable-next-line no-continue\n continue;\n }\n\n // Only clone the value if actually a value, not a getter / setter.\n if (!descriptor.get && !descriptor.set) {\n descriptor.value = state.clone(descriptor.value, state);\n }\n\n try {\n Object.defineProperty(clone, property, descriptor);\n } catch {\n // Tee above can fail on node in edge cases, so fall back to the loose assignment.\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment,no-param-reassign,@typescript-eslint/no-explicit-any,@typescript-eslint/no-unsafe-member-access\n (clone as any)[property] = descriptor.value;\n }\n }\n\n return clone;\n};\n\nexport default copyOwnProperties;\n","/**\n * Get an empty version of the object with the same prototype it has.\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst getCleanClone = (input: unknown): any => {\n if (!input) {\n return Object.create(null);\n }\n\n const Constructor = input.constructor;\n\n if (Constructor === Object) {\n return input === Object.prototype ? {} : Object.create(input);\n }\n\n // eslint-disable-next-line no-bitwise\n if (~Function.prototype.toString.call(Constructor).indexOf(\"[native code]\")) {\n try {\n // @ts-expect-error - We don't know the type of the object, can be a function\n return new Constructor();\n } catch {\n /* empty */\n }\n }\n\n return Object.create(input);\n};\n\nexport default getCleanClone;\n"]}
|
package/dist/chunk-ZJWITT73.cjs
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var chunkULIBPEBE_cjs = require('./chunk-ULIBPEBE.cjs');
|
|
4
|
-
|
|
5
|
-
var w=(e,r)=>{let t=[];r.cache.set(e,t);for(let n=0,{length:o}=e;n<o;++n)t[n]=r.clone(e[n],r);return t},S=(e,r)=>{let t=[];return r.cache.set(e,t),chunkULIBPEBE_cjs.a(e,t,r)};var y=e=>{let r={BigInt64Array,BigUint64Array,Buffer:Buffer.from,Float32Array,Float64Array,Int8Array,Int16Array,Int32Array,Uint8Array,Uint8ClampedArray,Uint16Array,Uint32Array};if(e instanceof ArrayBuffer){let n=new ArrayBuffer(e.byteLength),o=new Uint8Array(e);return new Uint8Array(n).set(o),n}let t=r[e.constructor.name]??void 0;return t?new t(e):new e.constructor([...e.buffer],e.byteOffset,e.length)},u=y;var V=e=>e.slice(0,e.size,e.type),g=V;var i=e=>new DataView(u(e.buffer)),P=i;var d=e=>new Date(e.getTime()),b=d;var f=(e,r)=>{let t=new e.constructor(e.message);return e.stack&&(t.stack=e.stack),e.code&&(t.code=e.code),e.errno&&(t.errno=e.errno),e.syscall&&(t.syscall=e.syscall),chunkULIBPEBE_cjs.a(e,t,r)},B=f;var x=(e,r)=>{let t=new Map;return r.cache.set(e,t),e.forEach((n,o)=>{t.set(o,r.clone(n,r));}),t},L=(e,r)=>chunkULIBPEBE_cjs.a(e,x(e,r),r);var p=(e,r)=>{Object.isExtensible(e)||Object.preventExtensions(r),Object.isSealed(e)&&Object.seal(r),Object.isFrozen(e)&&Object.freeze(r);},F=(e,r)=>{let t=chunkULIBPEBE_cjs.b(e);r.cache.set(e,t);for(let o in e)Object.hasOwnProperty.call(e,o)&&(t[o]=r.clone(e[o],r));let n=Object.getOwnPropertySymbols(e);for(let o=0,{length:c}=n,s;o<c;++o)s=n[o],Object.prototype.propertyIsEnumerable.call(e,s)&&(t[s]=r.clone(e[s],r));return p(e,t),t},z=(e,r)=>{let t=chunkULIBPEBE_cjs.b(e);r.cache.set(e,t);let n=chunkULIBPEBE_cjs.a(e,t,r),o=Object.getPrototypeOf(e);return Object.getPrototypeOf(n)!==o&&Object.setPrototypeOf(n,o),p(e,t),n};var H=e=>{let r=new RegExp(e.source,e.flags);return r.lastIndex=e.lastIndex,r},G=(e,r)=>{let t=new RegExp(e.source,e.flags);return chunkULIBPEBE_cjs.a(e,t,r)};var E=(e,r)=>{let t=new Set;return r.cache.set(e,t),e.forEach(n=>{t.add(r.clone(n,r));}),t},Q=(e,r)=>chunkULIBPEBE_cjs.a(e,E(e,r),r);
|
|
6
|
-
|
|
7
|
-
exports.a = w;
|
|
8
|
-
exports.b = S;
|
|
9
|
-
exports.c = u;
|
|
10
|
-
exports.d = g;
|
|
11
|
-
exports.e = P;
|
|
12
|
-
exports.f = b;
|
|
13
|
-
exports.g = B;
|
|
14
|
-
exports.h = x;
|
|
15
|
-
exports.i = L;
|
|
16
|
-
exports.j = F;
|
|
17
|
-
exports.k = z;
|
|
18
|
-
exports.l = H;
|
|
19
|
-
exports.m = G;
|
|
20
|
-
exports.n = E;
|
|
21
|
-
exports.o = Q;
|
|
22
|
-
//# sourceMappingURL=out.js.map
|
|
23
|
-
//# sourceMappingURL=chunk-ZJWITT73.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/handler/copy-array.ts","../src/handler/copy-array-buffer.ts","../src/handler/copy-blob.ts","../src/handler/copy-data-view.ts","../src/handler/copy-date.ts","../src/handler/copy-error.ts","../src/handler/copy-map.ts","../src/handler/copy-object.ts","../src/handler/copy-regexp.ts","../src/handler/copy-set.ts"],"names":["copyArrayLoose","array","state","clone","index","length","copyArrayStrict","copy_own_properties_default","copyArrayBuffer","arrayBuffer","typeHandlers","newBuffer","origView","Ctor","copy_array_buffer_default","copyBlob","blob","copy_blob_default","copyDataView","dataView","copy_data_view_default","copyDate","date","copy_date_default","copyError","object","error","copy_error_default","copyMapLoose","map","value","key","copyMapStrict","copyObjectIsFunctions","copyObjectLoose","get_clean_clone_default","symbols","symbol","copyObjectStrict","clonedObject","objectPrototype","copyRegExpLoose","regExp","copyRegExpStrict","copySetLoose","set","copySetStrict"],"mappings":"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","sourcesContent":["import type { State } from \"../types\";\nimport copyOwnProperties from \"../utils/copy-own-properties\";\n\nexport const copyArrayLoose = <Value extends unknown[]>(array: Value, state: State): Value => {\n const clone: Value = [] as unknown as Value;\n\n // set in the cache immediately to be able to reuse the object recursively\n state.cache.set(array, clone);\n\n // eslint-disable-next-line no-loops/no-loops,no-plusplus\n for (let index = 0, { length } = array; index < length; ++index) {\n clone[index] = state.clone(array[index], state);\n }\n\n return clone;\n};\n\n/**\n * Deeply copy the indexed values in the array, as well as any custom properties.\n */\nexport const copyArrayStrict = <Value extends unknown[]>(array: Value, state: State): Value => {\n const clone: Value = [] as unknown as Value;\n\n // set in the cache immediately to be able to reuse the object recursively\n state.cache.set(array, clone);\n\n return copyOwnProperties(array, clone, state);\n};\n","import type { TypedArray } from \"../types\";\n\nconst copyArrayBuffer = <Value extends ArrayBuffer | ArrayBufferView | Buffer | TypedArray>(arrayBuffer: Value): Value => {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const typeHandlers: Record<string, new (buffer: any) => any> = {\n BigInt64Array,\n BigUint64Array,\n // @ts-expect-error - Buffer has no constructor\n // eslint-disable-next-line @typescript-eslint/unbound-method\n Buffer: Buffer.from,\n Float32Array,\n Float64Array,\n Int8Array,\n Int16Array,\n Int32Array,\n Uint8Array,\n Uint8ClampedArray,\n Uint16Array,\n Uint32Array,\n };\n\n if (arrayBuffer instanceof ArrayBuffer) {\n const newBuffer = new ArrayBuffer(arrayBuffer.byteLength);\n const origView = new Uint8Array(arrayBuffer);\n const newView = new Uint8Array(newBuffer);\n\n newView.set(origView);\n\n return newBuffer as Value;\n }\n\n const Ctor = typeHandlers[arrayBuffer.constructor.name] ?? undefined;\n\n if (Ctor) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return\n return new Ctor(arrayBuffer);\n }\n\n // @ts-expect-error - Fallback to ArrayBufferView\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return\n return new (arrayBuffer as ArrayBufferView).constructor([...arrayBuffer.buffer], arrayBuffer.byteOffset, arrayBuffer.length);\n};\n\nexport default copyArrayBuffer;\n","const copyBlob = <Value extends Blob>(blob: Value): Value => blob.slice(0, blob.size, blob.type) as Value;\n\nexport default copyBlob;\n","import copyArrayBuffer from \"./copy-array-buffer\";\n\nconst copyDataView = <Value extends DataView>(dataView: Value): Value => new DataView(copyArrayBuffer(dataView.buffer)) as Value;\n\nexport default copyDataView;\n","const copyDate = <Value extends Date>(date: Value): Value => new Date(date.getTime()) as Value;\n\nexport default copyDate;\n","import type { State } from \"../types\";\nimport copyOwnProperties from \"../utils/copy-own-properties\";\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype ExtendedError = Error & { code?: any; errno?: any; syscall?: any };\n\nconst copyError = <Value extends EvalError | ExtendedError | RangeError | ReferenceError | SyntaxError | TypeError | URIError>(\n object: Value,\n state: State,\n): Value => {\n // @ts-expect-error - We don't know the type of the object, can be an error\n const error = new object.constructor(object.message) as EvalError | ExtendedError | RangeError | ReferenceError | SyntaxError | TypeError | URIError;\n\n // If a `stack` property is present, copy it over...\n if (object.stack) {\n error.stack = object.stack;\n }\n\n // Node.js specific (system errors)...\n if ((object as ExtendedError).code) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n (error as ExtendedError).code = (object as ExtendedError).code;\n }\n\n if ((object as ExtendedError).errno) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n (error as ExtendedError).errno = (object as ExtendedError).errno;\n }\n\n if ((object as ExtendedError).syscall) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n (error as ExtendedError).syscall = (object as ExtendedError).syscall;\n }\n\n return copyOwnProperties(object, error, state) as Value;\n};\n\nexport default copyError;\n","import type { State } from \"../types\";\nimport copyOwnProperties from \"../utils/copy-own-properties\";\n\nexport const copyMapLoose = <Value extends Map<unknown, unknown>>(map: Value, state: State): Value => {\n const clone = new Map() as Value;\n\n // set in the cache immediately to be able to reuse the object recursively\n state.cache.set(map, clone);\n\n map.forEach((value, key) => {\n clone.set(key, state.clone(value, state));\n });\n\n return clone;\n};\n\n/**\n * Deeply copy the keys and values of the original, as well as any custom properties.\n */\nexport const copyMapStrict = <Value extends Map<unknown, unknown>>(map: Value, state: State): Value =>\n copyOwnProperties(map, copyMapLoose<Value>(map, state), state);\n","import type { State } from \"../types\";\nimport copyOwnProperties from \"../utils/copy-own-properties\";\nimport getCleanClone from \"../utils/get-clean-clone\";\n\ndeclare const emptyObjectSymbol: unique symbol;\n\nconst copyObjectIsFunctions = <Value extends Record<PropertyKey, unknown>>(object: Value, clone: Value): void => {\n if (!Object.isExtensible(object)) {\n Object.preventExtensions(clone);\n }\n\n if (Object.isSealed(object)) {\n Object.seal(clone);\n }\n\n if (Object.isFrozen(object)) {\n Object.freeze(clone);\n }\n};\n\nexport const copyObjectLoose = <Value extends Record<PropertyKey, unknown>>(object: Value, state: State): Value => {\n const clone = getCleanClone(object) as { [emptyObjectSymbol]?: never };\n\n // set in the cache immediately to be able to reuse the object recursively\n state.cache.set(object, clone);\n\n // eslint-disable-next-line no-loops/no-loops,no-restricted-syntax\n for (const key in object) {\n if (Object.hasOwnProperty.call(object, key)) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-explicit-any\n (clone as any)[key] = state.clone(object[key], state);\n }\n }\n\n const symbols = Object.getOwnPropertySymbols(object);\n\n // eslint-disable-next-line no-loops/no-loops,no-plusplus\n for (let index = 0, { length } = symbols, symbol; index < length; ++index) {\n symbol = symbols[index] as symbol;\n\n if (Object.prototype.propertyIsEnumerable.call(object, symbol)) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-explicit-any\n (clone as any)[symbol] = state.clone((object as any)[symbol], state);\n }\n }\n\n copyObjectIsFunctions(object, clone as Value);\n\n return clone as Value;\n};\n\n/**\n * Deeply copy the properties (keys and symbols) and values of the original, as well\n * as any hidden or non-enumerable properties.\n */\nexport const copyObjectStrict = <Value extends Record<PropertyKey, unknown>>(object: Value, state: State): Value => {\n const clone = getCleanClone(object) as { [emptyObjectSymbol]?: never };\n\n // set in the cache immediately to be able to reuse the object recursively\n state.cache.set(object, clone);\n\n const clonedObject = copyOwnProperties<Value>(object, clone as Value, state);\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const objectPrototype: object | null = Object.getPrototypeOf(object);\n\n if (Object.getPrototypeOf(clonedObject) !== objectPrototype) {\n Object.setPrototypeOf(clonedObject, objectPrototype);\n }\n\n copyObjectIsFunctions(object, clone as Value);\n\n return clonedObject as Value;\n};\n","import type { State } from \"../types\";\nimport copyOwnProperties from \"../utils/copy-own-properties\";\n\nexport const copyRegExpLoose = <Value extends RegExp>(regExp: Value): Value => {\n // eslint-disable-next-line @rushstack/security/no-unsafe-regexp,security/detect-non-literal-regexp\n const clone = new RegExp(regExp.source, regExp.flags) as Value;\n\n clone.lastIndex = regExp.lastIndex;\n\n return clone;\n};\n\nexport const copyRegExpStrict = <Value extends RegExp>(regExp: Value, state: State): Value => {\n // eslint-disable-next-line @rushstack/security/no-unsafe-regexp,security/detect-non-literal-regexp\n const clone = new RegExp(regExp.source, regExp.flags) as Value;\n\n return copyOwnProperties(regExp, clone, state);\n};\n","import type { State } from \"../types\";\nimport copyOwnProperties from \"../utils/copy-own-properties\";\n\nexport const copySetLoose = <Value extends Set<unknown>>(set: Value, state: State): Value => {\n const clone = new Set() as Value;\n\n // set in the cache immediately to be able to reuse the object recursively\n state.cache.set(set, clone);\n\n set.forEach((value) => {\n clone.add(state.clone(value, state));\n });\n\n return clone;\n};\n\n/**\n * Deeply copy the values of the original, as well as any custom properties.\n */\nexport const copySetStrict = <Value extends Set<unknown>>(set: Value, state: State): Value => copyOwnProperties(set, copySetLoose<Value>(set, state), state);\n"]}
|
package/dist/handler.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":""}
|
package/dist/handler.js
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
export { c as copyArrayBuffer, a as copyArrayLoose, b as copyArrayStrict, d as copyBlob, e as copyDataView, f as copyDate, g as copyError, h as copyMapLoose, i as copyMapStrict, j as copyObjectLoose, k as copyObjectStrict, l as copyRegExpLoose, m as copyRegExpStrict, n as copySetLoose, o as copySetStrict } from './chunk-L5LW2LUR.js';
|
|
2
|
-
import './chunk-LPGIVFCB.js';
|
|
3
|
-
//# sourceMappingURL=out.js.map
|
|
4
|
-
//# sourceMappingURL=handler.js.map
|
package/dist/handler.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":""}
|
package/dist/index.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"names":["canValueHaveProperties","value","handlers","copyArrayLoose","copy_array_buffer_default","copy_blob_default","copy_data_view_default","copy_date_default","copy_error_default","object","_state","copyMapLoose","copyObjectLoose","copyRegExpLoose","copySetLoose","deepClone","originalData","options","cloner","copyArrayStrict","copyMapStrict","copyObjectStrict","copyRegExpStrict","copySetStrict","cache","clone","state","cloned"],"mappings":"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","sourcesContent":["import { copyArrayLoose, copyArrayStrict } from \"./handler/copy-array\";\nimport copyArrayBuffer from \"./handler/copy-array-buffer\";\nimport copyBlob from \"./handler/copy-blob\";\nimport copyDataView from \"./handler/copy-data-view\";\nimport copyDate from \"./handler/copy-date\";\nimport copyError from \"./handler/copy-error\";\nimport { copyMapLoose, copyMapStrict } from \"./handler/copy-map\";\nimport { copyObjectLoose, copyObjectStrict } from \"./handler/copy-object\";\nimport { copyRegExpLoose, copyRegExpStrict } from \"./handler/copy-regexp\";\nimport { copySetLoose, copySetStrict } from \"./handler/copy-set\";\nimport type { Options, State } from \"./types\";\n\n// eslint-disable-next-line @typescript-eslint/ban-types\nconst canValueHaveProperties = (value: unknown): value is NonNullable<Function | object> =>\n (typeof value === \"object\" && value !== null) || typeof value === \"function\";\n\n/**\n * handler mappings for different data types.\n */\nconst handlers = {\n Array: copyArrayLoose,\n ArrayBuffer: copyArrayBuffer,\n Blob: copyBlob,\n DataView: copyDataView,\n Date: copyDate,\n Error: copyError,\n // eslint-disable-next-line @typescript-eslint/ban-types,@typescript-eslint/no-unused-vars\n Function: (object: Function, _state: State) => object,\n Map: copyMapLoose,\n Object: copyObjectLoose,\n Promise: (object: Promise<unknown>) => {\n throw new TypeError(`${object.constructor.name} objects cannot be cloned`);\n },\n RegExp: copyRegExpLoose,\n Set: copySetLoose,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n SharedArrayBuffer: (object: SharedArrayBuffer, _state: State) => {\n throw new TypeError(`${object.constructor.name} objects cannot be cloned`);\n },\n WeakMap: (object: WeakMap<any, any>) => {\n throw new TypeError(`${object.constructor.name} objects cannot be cloned`);\n },\n WeakSet: (object: WeakSet<any>) => {\n throw new TypeError(`${object.constructor.name} objects cannot be cloned`);\n },\n};\n\ntype DeepReadwrite<T> = T extends object | [] ? { -readonly [P in keyof T]: DeepReadwrite<T[P]> } : T;\n\ninterface FakeJSDOM {\n cloneNode?: (check: boolean) => unknown;\n nodeType?: unknown;\n}\n\n/**\n * Function that creates a deep clone of an object or array.\n *\n * @template T - The type of the original data.\n * @param originalData - The original data to be cloned. It uses the generic parameter `T`.\n * @param options - Optional. The cloning options. Type of this parameter is `Options`.\n * @returns The deep cloned data with its type as `DeepReadwrite<T>`.\n */\n// eslint-disable-next-line sonarjs/cognitive-complexity\nexport const deepClone = <T>(originalData: T, options?: Options): DeepReadwrite<T> => {\n if (!canValueHaveProperties(originalData)) {\n return originalData as DeepReadwrite<T>;\n }\n\n const cloner = {\n ...handlers,\n ...(options?.strict ? { Array: copyArrayStrict, Map: copyMapStrict, Object: copyObjectStrict, RegExp: copyRegExpStrict, Set: copySetStrict } : {}),\n ...options?.handler,\n };\n\n let cache: WeakMap<any, any> | null = new WeakMap();\n\n const clone = (value: any, state: State): any => {\n if (!canValueHaveProperties(value)) {\n return value as DeepReadwrite<T>;\n }\n\n if (state.cache.has(value)) {\n return state.cache.get(value);\n }\n\n if (Array.isArray(value)) {\n return cloner.Array(value, state);\n }\n\n if (typeof value === \"object\" && value.constructor === Object && (value as FakeJSDOM).nodeType === undefined) {\n return cloner.Object(value as Record<PropertyKey, unknown>, state);\n }\n\n if ((value as FakeJSDOM).nodeType !== undefined && (value as FakeJSDOM).cloneNode !== undefined) {\n return (value as { cloneNode: (check: boolean) => unknown }).cloneNode(true);\n }\n\n if (value instanceof Date) {\n return cloner.Date(value, state);\n }\n\n if (value instanceof RegExp) {\n return cloner.RegExp(value, state);\n }\n\n if (value instanceof Map) {\n return cloner.Map(value, state);\n }\n\n if (value instanceof Set) {\n return cloner.Set(value, state);\n }\n\n if (value instanceof Error) {\n return cloner.Error(value, state);\n }\n\n if (\n value instanceof ArrayBuffer ||\n value instanceof Uint8Array ||\n value instanceof Uint8ClampedArray ||\n value instanceof Int8Array ||\n value instanceof Uint16Array ||\n value instanceof Int16Array ||\n value instanceof Uint32Array ||\n value instanceof Int32Array ||\n value instanceof Float32Array ||\n value instanceof Float64Array\n ) {\n return cloner.ArrayBuffer(value, state);\n }\n\n if (value instanceof Blob) {\n return cloner.Blob(value, state);\n }\n\n if (value instanceof DataView) {\n return cloner.DataView(value, state);\n }\n\n if (value instanceof SharedArrayBuffer) {\n return cloner.SharedArrayBuffer(value, state);\n }\n\n if (value instanceof Promise) {\n return cloner.Promise(value, state);\n }\n\n if (value instanceof WeakMap) {\n return cloner.WeakMap(value, state);\n }\n\n if (value instanceof WeakSet) {\n return cloner.WeakSet(value, state);\n }\n\n if (value instanceof Function) {\n return cloner.Function(value, state);\n }\n\n if (typeof value === \"object\") {\n return cloner.Object(value as Record<PropertyKey, unknown>, state);\n }\n\n throw new TypeError(`Type of ${typeof value} cannot be cloned`, value);\n };\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const cloned = clone(originalData, { cache, clone });\n\n // Reset the cache to free up memory\n cache = null;\n\n return cloned as DeepReadwrite<T>;\n};\n\n// eslint-disable-next-line import/no-unused-modules\nexport type { Options, State } from \"./types\";\n"]}
|
package/dist/index.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { b, i, k, m, o, a, c, d, e, f, g, h, j, l, n } from './chunk-L5LW2LUR.js';
|
|
2
|
-
import './chunk-LPGIVFCB.js';
|
|
3
|
-
|
|
4
|
-
var D=o=>typeof o=="object"&&o!==null||typeof o=="function",E={Array:a,ArrayBuffer:c,Blob:d,DataView:e,Date:f,Error:g,Function:(o,t)=>o,Map:h,Object:j,Promise:o=>{throw new TypeError(`${o.constructor.name} objects cannot be cloned`)},RegExp:l,Set:n,SharedArrayBuffer:(o,t)=>{throw new TypeError(`${o.constructor.name} objects cannot be cloned`)},WeakMap:o=>{throw new TypeError(`${o.constructor.name} objects cannot be cloned`)},WeakSet:o=>{throw new TypeError(`${o.constructor.name} objects cannot be cloned`)}},V=(o$1,t)=>{if(!D(o$1))return o$1;let e={...E,...t?.strict?{Array:b,Map:i,Object:k,RegExp:m,Set:o}:{},...t?.handler},c=new WeakMap,i$1=(r,n)=>{if(!D(r))return r;if(n.cache.has(r))return n.cache.get(r);if(Array.isArray(r))return e.Array(r,n);if(typeof r=="object"&&r.constructor===Object&&r.nodeType===void 0)return e.Object(r,n);if(r.nodeType!==void 0&&r.cloneNode!==void 0)return r.cloneNode(!0);if(r instanceof Date)return e.Date(r,n);if(r instanceof RegExp)return e.RegExp(r,n);if(r instanceof Map)return e.Map(r,n);if(r instanceof Set)return e.Set(r,n);if(r instanceof Error)return e.Error(r,n);if(r instanceof ArrayBuffer||r instanceof Uint8Array||r instanceof Uint8ClampedArray||r instanceof Int8Array||r instanceof Uint16Array||r instanceof Int16Array||r instanceof Uint32Array||r instanceof Int32Array||r instanceof Float32Array||r instanceof Float64Array)return e.ArrayBuffer(r,n);if(r instanceof Blob)return e.Blob(r,n);if(r instanceof DataView)return e.DataView(r,n);if(r instanceof SharedArrayBuffer)return e.SharedArrayBuffer(r,n);if(r instanceof Promise)return e.Promise(r,n);if(r instanceof WeakMap)return e.WeakMap(r,n);if(r instanceof WeakSet)return e.WeakSet(r,n);if(r instanceof Function)return e.Function(r,n);if(typeof r=="object")return e.Object(r,n);throw new TypeError(`Type of ${typeof r} cannot be cloned`,r)},M=i$1(o$1,{cache:c,clone:i$1});return c=null,M};
|
|
5
|
-
|
|
6
|
-
export { V as deepClone };
|
|
7
|
-
//# sourceMappingURL=out.js.map
|
|
8
|
-
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"names":["canValueHaveProperties","value","handlers","copyArrayLoose","copy_array_buffer_default","copy_blob_default","copy_data_view_default","copy_date_default","copy_error_default","object","_state","copyMapLoose","copyObjectLoose","copyRegExpLoose","copySetLoose","deepClone","originalData","options","cloner","copyArrayStrict","copyMapStrict","copyObjectStrict","copyRegExpStrict","copySetStrict","cache","clone","state","cloned"],"mappings":"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","sourcesContent":["import { copyArrayLoose, copyArrayStrict } from \"./handler/copy-array\";\nimport copyArrayBuffer from \"./handler/copy-array-buffer\";\nimport copyBlob from \"./handler/copy-blob\";\nimport copyDataView from \"./handler/copy-data-view\";\nimport copyDate from \"./handler/copy-date\";\nimport copyError from \"./handler/copy-error\";\nimport { copyMapLoose, copyMapStrict } from \"./handler/copy-map\";\nimport { copyObjectLoose, copyObjectStrict } from \"./handler/copy-object\";\nimport { copyRegExpLoose, copyRegExpStrict } from \"./handler/copy-regexp\";\nimport { copySetLoose, copySetStrict } from \"./handler/copy-set\";\nimport type { Options, State } from \"./types\";\n\n// eslint-disable-next-line @typescript-eslint/ban-types\nconst canValueHaveProperties = (value: unknown): value is NonNullable<Function | object> =>\n (typeof value === \"object\" && value !== null) || typeof value === \"function\";\n\n/**\n * handler mappings for different data types.\n */\nconst handlers = {\n Array: copyArrayLoose,\n ArrayBuffer: copyArrayBuffer,\n Blob: copyBlob,\n DataView: copyDataView,\n Date: copyDate,\n Error: copyError,\n // eslint-disable-next-line @typescript-eslint/ban-types,@typescript-eslint/no-unused-vars\n Function: (object: Function, _state: State) => object,\n Map: copyMapLoose,\n Object: copyObjectLoose,\n Promise: (object: Promise<unknown>) => {\n throw new TypeError(`${object.constructor.name} objects cannot be cloned`);\n },\n RegExp: copyRegExpLoose,\n Set: copySetLoose,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n SharedArrayBuffer: (object: SharedArrayBuffer, _state: State) => {\n throw new TypeError(`${object.constructor.name} objects cannot be cloned`);\n },\n WeakMap: (object: WeakMap<any, any>) => {\n throw new TypeError(`${object.constructor.name} objects cannot be cloned`);\n },\n WeakSet: (object: WeakSet<any>) => {\n throw new TypeError(`${object.constructor.name} objects cannot be cloned`);\n },\n};\n\ntype DeepReadwrite<T> = T extends object | [] ? { -readonly [P in keyof T]: DeepReadwrite<T[P]> } : T;\n\ninterface FakeJSDOM {\n cloneNode?: (check: boolean) => unknown;\n nodeType?: unknown;\n}\n\n/**\n * Function that creates a deep clone of an object or array.\n *\n * @template T - The type of the original data.\n * @param originalData - The original data to be cloned. It uses the generic parameter `T`.\n * @param options - Optional. The cloning options. Type of this parameter is `Options`.\n * @returns The deep cloned data with its type as `DeepReadwrite<T>`.\n */\n// eslint-disable-next-line sonarjs/cognitive-complexity\nexport const deepClone = <T>(originalData: T, options?: Options): DeepReadwrite<T> => {\n if (!canValueHaveProperties(originalData)) {\n return originalData as DeepReadwrite<T>;\n }\n\n const cloner = {\n ...handlers,\n ...(options?.strict ? { Array: copyArrayStrict, Map: copyMapStrict, Object: copyObjectStrict, RegExp: copyRegExpStrict, Set: copySetStrict } : {}),\n ...options?.handler,\n };\n\n let cache: WeakMap<any, any> | null = new WeakMap();\n\n const clone = (value: any, state: State): any => {\n if (!canValueHaveProperties(value)) {\n return value as DeepReadwrite<T>;\n }\n\n if (state.cache.has(value)) {\n return state.cache.get(value);\n }\n\n if (Array.isArray(value)) {\n return cloner.Array(value, state);\n }\n\n if (typeof value === \"object\" && value.constructor === Object && (value as FakeJSDOM).nodeType === undefined) {\n return cloner.Object(value as Record<PropertyKey, unknown>, state);\n }\n\n if ((value as FakeJSDOM).nodeType !== undefined && (value as FakeJSDOM).cloneNode !== undefined) {\n return (value as { cloneNode: (check: boolean) => unknown }).cloneNode(true);\n }\n\n if (value instanceof Date) {\n return cloner.Date(value, state);\n }\n\n if (value instanceof RegExp) {\n return cloner.RegExp(value, state);\n }\n\n if (value instanceof Map) {\n return cloner.Map(value, state);\n }\n\n if (value instanceof Set) {\n return cloner.Set(value, state);\n }\n\n if (value instanceof Error) {\n return cloner.Error(value, state);\n }\n\n if (\n value instanceof ArrayBuffer ||\n value instanceof Uint8Array ||\n value instanceof Uint8ClampedArray ||\n value instanceof Int8Array ||\n value instanceof Uint16Array ||\n value instanceof Int16Array ||\n value instanceof Uint32Array ||\n value instanceof Int32Array ||\n value instanceof Float32Array ||\n value instanceof Float64Array\n ) {\n return cloner.ArrayBuffer(value, state);\n }\n\n if (value instanceof Blob) {\n return cloner.Blob(value, state);\n }\n\n if (value instanceof DataView) {\n return cloner.DataView(value, state);\n }\n\n if (value instanceof SharedArrayBuffer) {\n return cloner.SharedArrayBuffer(value, state);\n }\n\n if (value instanceof Promise) {\n return cloner.Promise(value, state);\n }\n\n if (value instanceof WeakMap) {\n return cloner.WeakMap(value, state);\n }\n\n if (value instanceof WeakSet) {\n return cloner.WeakSet(value, state);\n }\n\n if (value instanceof Function) {\n return cloner.Function(value, state);\n }\n\n if (typeof value === \"object\") {\n return cloner.Object(value as Record<PropertyKey, unknown>, state);\n }\n\n throw new TypeError(`Type of ${typeof value} cannot be cloned`, value);\n };\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const cloned = clone(originalData, { cache, clone });\n\n // Reset the cache to free up memory\n cache = null;\n\n return cloned as DeepReadwrite<T>;\n};\n\n// eslint-disable-next-line import/no-unused-modules\nexport type { Options, State } from \"./types\";\n"]}
|
package/dist/utils.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":""}
|
package/dist/utils.js
DELETED
package/dist/utils.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":""}
|
|
File without changes
|
|
File without changes
|