bunshin-clone 1.0.4 → 1.0.6

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/dist/index.cjs CHANGED
@@ -1,13 +1,11 @@
1
1
  'use strict';
2
2
 
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
3
  // src/index.ts
6
4
  var EMPTY_OPTIONS = {};
7
5
  var { hasOwnProperty: HAS_OWN } = Object.prototype;
8
6
  var { toString: OBJECT_TO_STRING } = Object.prototype;
9
- function bunshinClone(source, options, ref) {
10
- return clone(source, options ?? EMPTY_OPTIONS, ref ?? /* @__PURE__ */ new WeakMap());
7
+ function bunshinClone(source, options) {
8
+ return clone(source, options ?? EMPTY_OPTIONS, /* @__PURE__ */ new WeakMap());
11
9
  }
12
10
  function clone(node, options, ref) {
13
11
  if (!isObject(node)) {
@@ -195,12 +193,11 @@ function isUnsafeKey(key) {
195
193
  * High-performance deep clone utility with descriptor support.
196
194
  * Supports circular ref and complex built-in types.
197
195
  *
198
- * @version 1.0.4
196
+ * @version 1.0.6
199
197
  * @author Yusuke Kamiyamane
200
198
  * @license MIT
201
199
  * @copyright Copyright (c) 2026 Yusuke Kamiyamane
202
200
  * @see {@link https://github.com/y14e/bunshin-clone}
203
201
  */
204
202
 
205
- exports.cloneWithDescriptors = cloneWithDescriptors;
206
- exports.default = bunshinClone;
203
+ module.exports = bunshinClone;
package/dist/index.d.cts CHANGED
@@ -3,7 +3,7 @@
3
3
  * High-performance deep clone utility with descriptor support.
4
4
  * Supports circular ref and complex built-in types.
5
5
  *
6
- * @version 1.0.4
6
+ * @version 1.0.6
7
7
  * @author Yusuke Kamiyamane
8
8
  * @license MIT
9
9
  * @copyright Copyright (c) 2026 Yusuke Kamiyamane
@@ -13,9 +13,6 @@ interface BunshinCloneOptions {
13
13
  readonly preserveDescriptors?: boolean;
14
14
  readonly strictDescriptors?: boolean;
15
15
  }
16
- type Ref = WeakMap<object, unknown>;
17
- type AnyObject = Record<PropertyKey, unknown>;
18
- declare function bunshinClone(source: unknown, options?: BunshinCloneOptions, ref?: Ref): unknown;
19
- declare function cloneWithDescriptors(node: AnyObject, options: BunshinCloneOptions, ref: Ref): AnyObject;
16
+ declare function bunshinClone<T>(source: T, options?: BunshinCloneOptions): T;
20
17
 
21
- export { type BunshinCloneOptions, cloneWithDescriptors, bunshinClone as default };
18
+ export { type BunshinCloneOptions, bunshinClone as default };
package/dist/index.d.ts CHANGED
@@ -3,7 +3,7 @@
3
3
  * High-performance deep clone utility with descriptor support.
4
4
  * Supports circular ref and complex built-in types.
5
5
  *
6
- * @version 1.0.4
6
+ * @version 1.0.6
7
7
  * @author Yusuke Kamiyamane
8
8
  * @license MIT
9
9
  * @copyright Copyright (c) 2026 Yusuke Kamiyamane
@@ -13,9 +13,6 @@ interface BunshinCloneOptions {
13
13
  readonly preserveDescriptors?: boolean;
14
14
  readonly strictDescriptors?: boolean;
15
15
  }
16
- type Ref = WeakMap<object, unknown>;
17
- type AnyObject = Record<PropertyKey, unknown>;
18
- declare function bunshinClone(source: unknown, options?: BunshinCloneOptions, ref?: Ref): unknown;
19
- declare function cloneWithDescriptors(node: AnyObject, options: BunshinCloneOptions, ref: Ref): AnyObject;
16
+ declare function bunshinClone<T>(source: T, options?: BunshinCloneOptions): T;
20
17
 
21
- export { type BunshinCloneOptions, cloneWithDescriptors, bunshinClone as default };
18
+ export { type BunshinCloneOptions, bunshinClone as default };
package/dist/index.js CHANGED
@@ -2,8 +2,8 @@
2
2
  var EMPTY_OPTIONS = {};
3
3
  var { hasOwnProperty: HAS_OWN } = Object.prototype;
4
4
  var { toString: OBJECT_TO_STRING } = Object.prototype;
5
- function bunshinClone(source, options, ref) {
6
- return clone(source, options ?? EMPTY_OPTIONS, ref ?? /* @__PURE__ */ new WeakMap());
5
+ function bunshinClone(source, options) {
6
+ return clone(source, options ?? EMPTY_OPTIONS, /* @__PURE__ */ new WeakMap());
7
7
  }
8
8
  function clone(node, options, ref) {
9
9
  if (!isObject(node)) {
@@ -191,11 +191,11 @@ function isUnsafeKey(key) {
191
191
  * High-performance deep clone utility with descriptor support.
192
192
  * Supports circular ref and complex built-in types.
193
193
  *
194
- * @version 1.0.4
194
+ * @version 1.0.6
195
195
  * @author Yusuke Kamiyamane
196
196
  * @license MIT
197
197
  * @copyright Copyright (c) 2026 Yusuke Kamiyamane
198
198
  * @see {@link https://github.com/y14e/bunshin-clone}
199
199
  */
200
200
 
201
- export { cloneWithDescriptors, bunshinClone as default };
201
+ export { bunshinClone as default };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bunshin-clone",
3
- "version": "1.0.4",
3
+ "version": "1.0.6",
4
4
  "description": "High-performance deep clone utility with descriptor support",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",