@zuplo/cli 7.15.26 → 7.15.30
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/source/ai-gateway/catalog.json +170 -1
- package/dist/source/ai-gateway/planner.d.ts +2 -2
- package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/jwks/remote.js +2 -2
- package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/jwt/encrypt.js +5 -8
- package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/lib/jwe_decrypt.js +1 -1
- package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/lib/jwe_encrypt.js +2 -2
- package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/lib/jwt_claims_set.js +1 -1
- package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/lib/key.js +2 -0
- package/node_modules/@modelcontextprotocol/client/node_modules/jose/package.json +1 -1
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/jwks/remote.js +2 -2
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/jwt/encrypt.js +5 -8
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/jwe_decrypt.js +1 -1
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/jwe_encrypt.js +2 -2
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/jwt_claims_set.js +1 -1
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/key.js +2 -0
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/package.json +1 -1
- package/node_modules/@posthog/core/dist/gzip.d.ts +2 -0
- package/node_modules/@posthog/core/dist/gzip.d.ts.map +1 -1
- package/node_modules/@posthog/core/dist/gzip.js +17 -1
- package/node_modules/@posthog/core/dist/gzip.mjs +15 -2
- package/node_modules/@posthog/core/package.json +2 -2
- package/node_modules/@posthog/core/src/gzip.ts +21 -4
- package/node_modules/@posthog/types/dist/posthog-config.d.ts +82 -0
- package/node_modules/@posthog/types/dist/posthog-config.d.ts.map +1 -1
- package/node_modules/@posthog/types/package.json +1 -1
- package/node_modules/@posthog/types/src/posthog-config.ts +84 -0
- package/node_modules/@zuplo/core/customer.cli.minified.js +296 -296
- package/node_modules/@zuplo/core/index.minified.js +305 -305
- package/node_modules/@zuplo/core/package.json +1 -1
- package/node_modules/@zuplo/graphql/package.json +1 -1
- package/node_modules/@zuplo/openapi-tools/package.json +1 -1
- package/node_modules/@zuplo/otel/package.json +1 -1
- package/node_modules/@zuplo/runtime/out/esm/{chunk-I65Y62VQ.js → chunk-3ITT2MYM.js} +10 -10
- package/node_modules/@zuplo/runtime/out/esm/chunk-3ITT2MYM.js.map +1 -0
- package/node_modules/@zuplo/runtime/out/esm/{chunk-5XXEIH5B.js → chunk-A7HRIAHJ.js} +2 -2
- package/node_modules/@zuplo/runtime/out/esm/{chunk-6KHAYHSW.js → chunk-C4ZTXG6P.js} +4 -4
- package/node_modules/@zuplo/runtime/out/esm/chunk-C4ZTXG6P.js.map +1 -0
- package/node_modules/@zuplo/runtime/out/esm/{chunk-APWLPHXH.js → chunk-JAY7SQGG.js} +2 -2
- package/node_modules/@zuplo/runtime/out/esm/{chunk-MWNVPFFM.js → chunk-YTDIY7PP.js} +2 -2
- package/node_modules/@zuplo/runtime/out/esm/index.js +1 -1
- package/node_modules/@zuplo/runtime/out/esm/mcp/messages/index.js +1 -1
- package/node_modules/@zuplo/runtime/out/esm/mcp-gateway/index.js +1 -1
- package/node_modules/@zuplo/runtime/out/esm/mocks/index.js +1 -1
- package/node_modules/@zuplo/runtime/out/esm/sdks/aws/index.js +1 -1
- package/node_modules/@zuplo/runtime/out/types/index.d.ts +16 -0
- package/node_modules/@zuplo/runtime/out/types/internal/index.d.ts +16 -0
- package/node_modules/@zuplo/runtime/package.json +1 -1
- package/node_modules/express-rate-limit/dist/index.cjs +6 -4
- package/node_modules/express-rate-limit/dist/index.mjs +6 -4
- package/node_modules/express-rate-limit/package.json +1 -1
- package/node_modules/fast-copy/README.md +15 -0
- package/node_modules/fast-copy/dist/cjs/index.cjs +33 -8
- package/node_modules/fast-copy/dist/cjs/index.cjs.map +1 -1
- package/node_modules/fast-copy/dist/es/index.mjs +33 -8
- package/node_modules/fast-copy/dist/es/index.mjs.map +1 -1
- package/node_modules/fast-copy/dist/umd/index.js +33 -8
- package/node_modules/fast-copy/dist/umd/index.js.map +1 -1
- package/node_modules/fast-copy/package.json +1 -1
- package/node_modules/object-inspect/CHANGELOG.md +31 -0
- package/node_modules/object-inspect/index.js +326 -24
- package/node_modules/object-inspect/package.json +22 -13
- package/node_modules/object-inspect/readme.markdown +4 -1
- package/node_modules/object-inspect/stringWidth.js +68 -0
- package/node_modules/object-inspect/stringWidthRanges.js +38 -0
- package/package.json +11 -11
- package/node_modules/@zuplo/runtime/out/esm/chunk-6KHAYHSW.js.map +0 -1
- package/node_modules/@zuplo/runtime/out/esm/chunk-I65Y62VQ.js.map +0 -1
- package/node_modules/object-inspect/.eslintrc +0 -53
- package/node_modules/object-inspect/.nycrc +0 -13
- package/node_modules/object-inspect/example/all.js +0 -23
- package/node_modules/object-inspect/example/circular.js +0 -6
- package/node_modules/object-inspect/example/fn.js +0 -5
- package/node_modules/object-inspect/example/inspect.js +0 -10
- package/node_modules/object-inspect/test/bigint.js +0 -58
- package/node_modules/object-inspect/test/browser/dom.js +0 -15
- package/node_modules/object-inspect/test/circular.js +0 -16
- package/node_modules/object-inspect/test/deep.js +0 -12
- package/node_modules/object-inspect/test/element.js +0 -53
- package/node_modules/object-inspect/test/err.js +0 -48
- package/node_modules/object-inspect/test/fakes.js +0 -29
- package/node_modules/object-inspect/test/fn.js +0 -76
- package/node_modules/object-inspect/test/global.js +0 -17
- package/node_modules/object-inspect/test/has.js +0 -15
- package/node_modules/object-inspect/test/holes.js +0 -15
- package/node_modules/object-inspect/test/indent-option.js +0 -271
- package/node_modules/object-inspect/test/inspect.js +0 -139
- package/node_modules/object-inspect/test/lowbyte.js +0 -12
- package/node_modules/object-inspect/test/number.js +0 -58
- package/node_modules/object-inspect/test/quoteStyle.js +0 -26
- package/node_modules/object-inspect/test/toStringTag.js +0 -40
- package/node_modules/object-inspect/test/undef.js +0 -12
- package/node_modules/object-inspect/test/values.js +0 -261
- package/node_modules/object-inspect/test-core-js.js +0 -26
- /package/node_modules/@zuplo/runtime/out/esm/{chunk-I65Y62VQ.js.LEGAL.txt → chunk-3ITT2MYM.js.LEGAL.txt} +0 -0
- /package/node_modules/@zuplo/runtime/out/esm/{chunk-5XXEIH5B.js.map → chunk-A7HRIAHJ.js.map} +0 -0
- /package/node_modules/@zuplo/runtime/out/esm/{chunk-6KHAYHSW.js.LEGAL.txt → chunk-C4ZTXG6P.js.LEGAL.txt} +0 -0
- /package/node_modules/@zuplo/runtime/out/esm/{chunk-APWLPHXH.js.map → chunk-JAY7SQGG.js.map} +0 -0
- /package/node_modules/@zuplo/runtime/out/esm/{chunk-MWNVPFFM.js.map → chunk-YTDIY7PP.js.map} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../../../src/utils.ts","../../../src/copier.ts","../../../src/options.ts","../../../src/index.ts"],"sourcesContent":["export interface Cache {\n has: (value: any) => boolean;\n set: (key: any, value: any) => void;\n get: (key: any) => any;\n}\n\n/**\n * Error thrown when the copier traverses deeper than the configured `maxDepth`.\n *\n * @note\n * Extends `RangeError` for backwards compatibility, since exceeding the maximum depth\n * previously surfaced as a native `RangeError` from stack exhaustion.\n */\nexport class MaxDepthExceededError extends RangeError {\n readonly maxDepth: number;\n\n constructor(maxDepth: number) {\n super(`Maximum copy depth of ${String(maxDepth)} exceeded; the value copied is nested too deeply.`);\n\n this.maxDepth = maxDepth;\n this.name = 'MaxDepthExceededError';\n }\n}\n\n// eslint-disable-next-line @typescript-eslint/unbound-method\nconst toStringFunction = Function.prototype.toString;\n// eslint-disable-next-line @typescript-eslint/unbound-method\nconst toStringObject = Object.prototype.toString;\n\n/**\n * Get an empty version of the object with the same prototype it has.\n */\nexport function getCleanClone(prototype: any): any {\n if (!prototype) {\n return Object.create(null);\n }\n\n const Constructor = prototype.constructor;\n\n if (Constructor === Object) {\n return prototype === Object.prototype ? {} : Object.create(prototype as object | null);\n }\n\n // 2026-10-10: Prototype constructor properties may contain ordinary data.\n if (typeof Constructor === 'function' && ~toStringFunction.call(Constructor).indexOf('[native code]')) {\n try {\n return new Constructor();\n } catch {\n // Ignore\n }\n }\n\n return Object.create(prototype as object | null);\n}\n\n/**\n * Get the tag of the value passed, so that the correct copier can be used.\n */\nexport function getTag(value: any): string {\n const stringTag = value[Symbol.toStringTag];\n\n if (stringTag) {\n return stringTag;\n }\n\n const type = toStringObject.call(value);\n\n return type.substring(8, type.length - 1);\n}\n","import { getCleanClone, getTag } from './utils.js';\nimport type { Cache } from './utils.ts';\n\nexport type InternalCopier<Value> = (value: Value, state: State) => Value;\n\nexport interface State {\n /**\n * The constructor of the value currently being copied, derived from its `prototype`.\n * Used to construct the clone for values that are not plain objects, such as subclasses\n * of `Array` or custom classes.\n *\n * @note\n * This is `undefined` for primitives and for values already present in the `cache`. It is\n * also reassigned for every value copied, so it must be read before any recursive\n * `copier` call is made, not after.\n */\n Constructor: any;\n /**\n * The cache of values already copied, mapping each original to its clone. Copiers should\n * populate it with the clone _before_ copying that value's contents, so that circular\n * references resolve to the clone rather than recursing infinitely.\n */\n cache: Cache;\n /**\n * The copier used for nested values. Call it as `state.copier(value, state)` to deeply\n * copy the contents of the value being copied.\n */\n copier: InternalCopier<any>;\n /**\n * The number of nested objects currently being copied, used to bound traversal of\n * deeply-nested values before the call stack is exhausted.\n *\n * @note\n * This is maintained by the copier itself; custom methods should not modify it.\n */\n depth: number;\n /**\n * The prototype of the value currently being copied, used to create a clone that\n * maintains the original's prototype chain.\n *\n * @note\n * This is `undefined` for primitives and for values already present in the `cache`. It is\n * also reassigned for every value copied, so it must be read before any recursive\n * `copier` call is made, not after.\n */\n prototype: any;\n}\n\n/**\n * The shared `%TypedArray%.prototype.slice`, which every typed array inherits.\n *\n * @note\n * This is used instead of the `slice` found on the value itself because subclasses can\n * override it with one that does not copy. `Buffer` is the notable case: its `slice`\n * returns a view over the same memory, so copying through it would alias the original.\n */\nconst sliceTypedArray = Object.getPrototypeOf(Int8Array.prototype).slice as (\n this: ArrayBufferView,\n start: number,\n) => ArrayBufferView;\n\n/**\n * Copy the descriptor from the original value to the clone.\n */\nfunction copyOwnDescriptor<Value extends object>(\n original: Value,\n clone: Value,\n property: string | symbol,\n state: State,\n): void {\n const ownDescriptor = Object.getOwnPropertyDescriptor(original, property) || {\n configurable: true,\n enumerable: true,\n value: original[property as keyof Value],\n writable: true,\n };\n const descriptor =\n ownDescriptor.get || ownDescriptor.set\n ? ownDescriptor\n : {\n configurable: ownDescriptor.configurable,\n enumerable: ownDescriptor.enumerable,\n value: state.copier(ownDescriptor.value, state),\n writable: ownDescriptor.writable,\n };\n\n try {\n Object.defineProperty(clone, property, descriptor);\n } catch {\n // The above can fail on node in extreme edge cases, so fall back to the loose assignment.\n clone[property as keyof Value] = descriptor.get ? descriptor.get() : descriptor.value;\n }\n}\n\n/**\n * Strictly copy all properties contained on the object, starting with the name at the `start` index.\n *\n * @note\n * `Object.getOwnPropertyNames` lists integer keys first in ascending order, so array-like values\n * whose indices are already copied can pass their count as `start` to skip them.\n */\nfunction copyOwnPropertiesStrict<Value extends object>(\n value: Value,\n clone: Value,\n state: State,\n names: string[],\n start: number,\n): Value {\n for (let index = start; index < names.length; ++index) {\n copyOwnDescriptor(value, clone, names[index]!, state);\n }\n\n for (const symbol of Object.getOwnPropertySymbols(value)) {\n copyOwnDescriptor(value, clone, symbol, state);\n }\n\n return clone;\n}\n\n/**\n * Deeply copy the indexed values in the array.\n */\nexport function copyArray<Value extends any[]>(array: Value, state: State): Value {\n const clone = new state.Constructor();\n\n // set in the cache immediately to be able to reuse the object recursively\n state.cache.set(array, clone);\n\n for (let index = 0; index < array.length; ++index) {\n clone[index] = state.copier(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 function copyArrayStrict<Value extends any[]>(array: Value, state: State): Value {\n const clone = new state.Constructor() 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 // Indices are copied by descriptor rather than by assignment, unlike typed arrays and strings,\n // because array indices can be holes, accessors, or non-writable / non-enumerable values.\n return copyOwnPropertiesStrict(array, clone, state, Object.getOwnPropertyNames(array), 0);\n}\n\n/**\n * Copy the contents of the ArrayBuffer, or of the typed array viewing one.\n *\n * @note\n * `slice` always returns a fixed-length buffer, so a resizable or growable buffer that can change\n * size is instead constructed with the same `maxByteLength` and has its contents copied in.\n */\nexport function copyArrayBuffer<Value extends ArrayBufferLike | ArrayBufferView>(\n arrayBuffer: Value,\n state: State,\n): Value {\n if (ArrayBuffer.isView(arrayBuffer)) {\n return sliceTypedArray.call(arrayBuffer, 0) as Value;\n }\n\n if ((arrayBuffer as ArrayBuffer).resizable || (arrayBuffer as SharedArrayBuffer).growable) {\n const maxByteLength = (arrayBuffer as ArrayBuffer).maxByteLength;\n const clone = new state.Constructor(arrayBuffer.byteLength, { maxByteLength });\n\n // The new buffer is zero-filled, and buffers can only be read or written through a view, so\n // copy the original's bytes into it through byte-level views of both. Without this, the clone\n // would have the right size but be all zeros.\n new Uint8Array(clone).set(new Uint8Array(arrayBuffer));\n\n return clone as Value;\n }\n\n // V8 throws when slicing an empty, fixed-length SharedArrayBuffer.\n if (!arrayBuffer.byteLength && getTag(arrayBuffer) === 'SharedArrayBuffer') {\n return new state.Constructor(0) as Value;\n }\n\n return arrayBuffer.slice(0) as Value;\n}\n\n/**\n * Copy the contents of the ArrayBuffer, or of the typed array viewing one, as well as\n * any custom properties.\n */\nexport function copyArrayBufferStrict<Value extends ArrayBufferLike | ArrayBufferView>(\n arrayBuffer: Value,\n state: State,\n): Value {\n const clone = copyArrayBuffer(arrayBuffer, state);\n\n // set in the cache immediately to be able to reuse the object recursively\n state.cache.set(arrayBuffer, clone);\n\n // Typed arrays list their indices first, but unlike arrays have no own `length` to skip. The\n // fresh clone is read, since the original may have an own `length` that shadows the real one.\n const start = ArrayBuffer.isView(clone) ? (clone as unknown as ArrayLike<unknown>).length || 0 : 0;\n\n return copyOwnPropertiesStrict(arrayBuffer, clone, state, Object.getOwnPropertyNames(arrayBuffer), start);\n}\n\n/**\n * Create a new Blob with the contents of the original.\n */\nexport function copyBlob<Value extends Blob>(blob: Value, _state: State): Value {\n return blob.slice(0, blob.size, blob.type) as Value;\n}\n\n/**\n * Create a new Blob with the contents of the original, and copy any custom properties.\n */\nexport const copyBlobStrict = createStrictHandler(copyBlob);\n\n/**\n * Create a new DataView with the contents of the original.\n */\nexport function copyDataView<Value extends DataView>(dataView: Value, state: State): Value {\n return new state.Constructor(state.copier(dataView.buffer, state), dataView.byteOffset, dataView.byteLength);\n}\n\n/**\n * Create a new DataView with the contents of the original, and copy any custom properties.\n *\n * @note\n * The buffer is shared with any other reference to it in the value being copied, and has\n * its own custom properties copied, the same as if it were reached directly.\n */\nexport function copyDataViewStrict<Value extends DataView>(dataView: Value, state: State): Value {\n const { buffer } = dataView;\n const { cache, Constructor } = state;\n const bufferCopied = cache.has(buffer);\n const bufferClone = bufferCopied ? cache.get(buffer) : state.copier(buffer, state);\n\n // The buffer's custom properties may reference this DataView, in which case copying the buffer\n // already created and cached its clone. Reuse it so that every reference resolves to one clone.\n if (!bufferCopied && cache.has(dataView)) {\n return cache.get(dataView);\n }\n\n const clone = new Constructor(bufferClone, dataView.byteOffset, dataView.byteLength) as Value;\n\n // set in the cache immediately to be able to reuse the object recursively.\n state.cache.set(dataView, clone);\n\n return copyOwnPropertiesStrict(dataView, clone, state, Object.getOwnPropertyNames(dataView), 0);\n}\n\n/**\n * Create a new Date based on the time of the original.\n */\nexport function copyDate<Value extends Date>(date: Value, state: State): Value {\n return new state.Constructor(date.getTime());\n}\n\n/**\n * Create a new Date based on the time of the original, and copy any custom properties.\n */\nexport const copyDateStrict = createStrictHandler(copyDate);\n\n/**\n * Deeply copy the keys and values of the original.\n */\nexport function copyMap<Value extends Map<any, any>>(map: Value, state: State): Value {\n const clone = new state.Constructor() 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 for (const [key, value] of map) {\n clone.set(key, state.copier(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 function copyMapStrict<Value extends Map<any, any>>(map: Value, state: State): Value {\n return copyOwnPropertiesStrict(map, copyMap(map, state), state, Object.getOwnPropertyNames(map), 0);\n}\n\n/**\n * Deeply copy the properties (keys and symbols) and values of the original.\n */\nexport function copyObject<Value extends Record<string, any>>(object: Value, state: State): Value {\n const clone = getCleanClone(state.prototype);\n\n // set in the cache immediately to be able to reuse the object recursively\n state.cache.set(object, clone);\n\n for (const key of Object.keys(object)) {\n if (key === '__proto__') {\n // Native assignment would attempt to use `Object.setPropertyOf` under the hood, when this\n // property has been explicitly set as a standard property. Using `defineProperty` ensures\n // its treatment in the clone is unchanged from the source.\n Object.defineProperty(clone, key, {\n configurable: true,\n enumerable: true,\n value: state.copier(object[key], state),\n writable: true,\n });\n } else {\n clone[key] = state.copier(object[key], state);\n }\n }\n\n for (const symbol of Object.getOwnPropertySymbols(object)) {\n // Only copy enumerable symbols in loose mode, to align with handling of `keys`.\n if (Object.prototype.propertyIsEnumerable.call(object, symbol)) {\n clone[symbol] = state.copier((object as any)[symbol], state);\n }\n }\n\n return clone;\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 function copyObjectStrict<Value extends Record<string, any>>(object: Value, state: State): Value {\n const clone = getCleanClone(state.prototype);\n\n // set in the cache immediately to be able to reuse the object recursively\n state.cache.set(object, clone);\n\n return copyOwnPropertiesStrict(object, clone, state, Object.getOwnPropertyNames(object), 0);\n}\n\n/**\n * Create a new primitive wrapper from the value of the original.\n */\nexport function copyPrimitiveWrapper<\n // Specifically use the object constructor types\n // eslint-disable-next-line @typescript-eslint/no-wrapper-object-types\n Value extends Boolean | Number | String,\n>(primitiveObject: Value, state: State): Value {\n return new state.Constructor(primitiveObject.valueOf());\n}\n\n/**\n * Create a new primitive wrapper from the value of the original, and copy any\n * custom properties.\n */\nexport const copyPrimitiveWrapperStrict = createStrictHandler(copyPrimitiveWrapper);\n\n/**\n * Create a new RegExp based on the value and flags of the original.\n */\nexport function copyRegExp<Value extends RegExp>(regExp: Value, state: State): Value {\n const clone = new state.Constructor(regExp.source, regExp.flags) as Value;\n\n // `lastIndex` is not retained when constructing anew, so manually copy it.\n clone.lastIndex = regExp.lastIndex;\n\n return clone;\n}\n\n/**\n * Copy the original RegExp, as well as any custom properties.\n */\nexport const copyRegExpStrict = createStrictHandler(copyRegExp);\n\n/**\n * Return the original value (an identity function).\n *\n * @note\n * THis is used for objects that cannot be copied, such as WeakMap.\n */\nexport function copySelf<Value>(value: Value, _state: State): Value {\n return value;\n}\n\n/**\n * Deeply copy the values of the original.\n */\nexport function copySet<Value extends Set<any>>(set: Value, state: State): Value {\n const clone = new state.Constructor() 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 for (const value of set) {\n clone.add(state.copier(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 function copySetStrict<Value extends Set<any>>(set: Value, state: State): Value {\n return copyOwnPropertiesStrict(set, copySet(set, state), state, Object.getOwnPropertyNames(set), 0);\n}\n\n/**\n * Copy the original value based on the handler passed, and also copy custom properties.\n *\n * @note\n * The handlers used here have no nested values to copy, so they skip the cache to keep loose\n * copies fast. Custom properties can reference the value itself, so the clone is cached here\n * before they are copied.\n */\nfunction createStrictHandler<Value extends object>(handler: (value: Value, state: State) => Value) {\n return (value: Value, state: State): Value => {\n const clone = handler(value, state);\n\n // set in the cache immediately to be able to reuse the object recursively\n state.cache.set(value, clone);\n\n return copyOwnPropertiesStrict(value, clone, state, Object.getOwnPropertyNames(value), 0);\n };\n}\n\n/**\n * Create a new String wrapper from the value of the original, and copy custom properties.\n */\n// `String` primitive constructor is intentional.\n// eslint-disable-next-line @typescript-eslint/no-wrapper-object-types\nexport function copyStringStrict<Value extends String>(string: Value, state: State): Value {\n const clone = copyPrimitiveWrapper(string, state);\n\n // set in the cache immediately to be able to reuse the object recursively\n state.cache.set(string, clone);\n\n const { length } = string;\n const names = Object.getOwnPropertyNames(string);\n // Custom integer keys beyond the string's length are listed before `length`, so only skip\n // `length` when it directly follows the characters.\n const start = names[length] === 'length' ? length + 1 : length;\n\n return copyOwnPropertiesStrict(string, clone, state, names, start);\n}\n","import {\n copyArrayBuffer,\n copyArrayBufferStrict,\n copyArray,\n copyArrayStrict,\n copyBlob,\n copyBlobStrict,\n copyDataView,\n copyDataViewStrict,\n copyDate,\n copyDateStrict,\n copyMap,\n copyMapStrict,\n copyObject,\n copyObjectStrict,\n copyPrimitiveWrapper,\n copyPrimitiveWrapperStrict,\n copyRegExp,\n copyRegExpStrict,\n copySelf,\n copySet,\n copySetStrict,\n copyStringStrict,\n} from './copier.js';\nimport type { InternalCopier } from './copier.ts';\nimport type { Cache } from './utils.ts';\n\nexport interface CopierMethods {\n array?: InternalCopier<any[]>;\n arrayBuffer?: InternalCopier<ArrayBuffer>;\n asyncGenerator?: InternalCopier<AsyncGenerator>;\n blob?: InternalCopier<Blob>;\n dataView?: InternalCopier<DataView>;\n date?: InternalCopier<Date>;\n error?: InternalCopier<Error>;\n generator?: InternalCopier<Generator>;\n map?: InternalCopier<Map<any, any>>;\n object?: InternalCopier<Record<string, any>>;\n regExp?: InternalCopier<RegExp>;\n set?: InternalCopier<Set<any>>;\n}\n\ninterface Copiers {\n [key: string]: InternalCopier<any> | undefined;\n\n Arguments: InternalCopier<Record<string, any>>;\n Array: InternalCopier<any[]>;\n ArrayBuffer: InternalCopier<ArrayBuffer>;\n AsyncGenerator: InternalCopier<AsyncGenerator>;\n BigInt64Array: InternalCopier<ArrayBuffer>;\n BigUint64Array: InternalCopier<ArrayBuffer>;\n Blob: InternalCopier<Blob>;\n // eslint-disable-next-line @typescript-eslint/no-wrapper-object-types\n Boolean: InternalCopier<Boolean>;\n DataView: InternalCopier<DataView>;\n Date: InternalCopier<Date>;\n Error: InternalCopier<Error>;\n Float32Array: InternalCopier<ArrayBuffer>;\n Float64Array: InternalCopier<ArrayBuffer>;\n Generator: InternalCopier<Generator>;\n Int8Array: InternalCopier<ArrayBuffer>;\n Int16Array: InternalCopier<ArrayBuffer>;\n Int32Array: InternalCopier<ArrayBuffer>;\n Map: InternalCopier<Map<any, any>>;\n // eslint-disable-next-line @typescript-eslint/no-wrapper-object-types\n Number: InternalCopier<Number>;\n Object: InternalCopier<Record<string, any>>;\n Promise: InternalCopier<Promise<any>>;\n RegExp: InternalCopier<RegExp>;\n Set: InternalCopier<Set<any>>;\n SharedArrayBuffer: InternalCopier<SharedArrayBuffer>;\n // eslint-disable-next-line @typescript-eslint/no-wrapper-object-types\n String: InternalCopier<String>;\n WeakMap: InternalCopier<WeakMap<any, any>>;\n WeakSet: InternalCopier<WeakSet<any>>;\n Uint8Array: InternalCopier<ArrayBuffer>;\n Uint8ClampedArray: InternalCopier<ArrayBuffer>;\n Uint16Array: InternalCopier<ArrayBuffer>;\n Uint32Array: InternalCopier<ArrayBuffer>;\n}\n\nexport interface CreateCopierOptions {\n /**\n * Creates the cache used to track values already copied, which is what allows circular\n * references to resolve to their clone instead of recursing infinitely. A new cache is\n * created for each top-level copy. Since it only needs to satisfy the `has` / `get` /\n * `set` contract, a bounded implementation such as an LRU cache can be used to trade\n * circular reference handling for a smaller memory footprint.\n *\n * @default () => new WeakMap()\n */\n createCache?: () => Cache;\n /**\n * The maximum number of nested objects to traverse before throwing a\n * `MaxDepthExceededError`. Pass `Infinity` to traverse without a limit.\n *\n * @default 1000\n */\n maxDepth?: number;\n /**\n * Overrides of the copiers used for specific object types, allowing custom copy\n * semantics for those types. Any type not overridden uses its default copier. Each\n * method receives the value to copy and the current `State`, and is responsible for\n * populating `state.cache` and recursing via `state.copier` if it wants circular\n * reference handling and deep copies respectively.\n */\n methods?: CopierMethods;\n /**\n * Copies all own properties with their original property descriptors, including\n * non-enumerable properties, symbols, and non-index properties on arrays.\n *\n * @note\n * This is significantly slower than the default \"loose\" copy, so it should only be used\n * when the exact shape of the original must be replicated.\n *\n * @default false\n */\n strict?: boolean;\n}\n\nexport interface RequiredCreateCopierOptions extends Omit<Required<CreateCopierOptions>, 'methods'> {\n copiers: Copiers;\n methods: Required<CopierMethods>;\n}\n\n/**\n * The maximum depth traversed when none is provided.\n *\n * @note\n * This is deliberately below the depth at which the native call stack is exhausted\n * (~1875 for strict copies in node), so that untrusted, deeply-nested values fail with a\n * catchable, descriptive error instead of a raw `RangeError`.\n */\nexport const DEFAULT_MAX_DEPTH = 1000;\n\nexport function createDefaultCache(): Cache {\n return new WeakMap();\n}\n\nexport function getOptions({\n createCache: createCacheOverride,\n maxDepth,\n methods: methodsOverride,\n strict,\n}: CreateCopierOptions): RequiredCreateCopierOptions {\n const defaultMethods = {\n array: strict ? copyArrayStrict : copyArray,\n arrayBuffer: strict ? copyArrayBufferStrict : copyArrayBuffer,\n asyncGenerator: copySelf,\n blob: strict ? copyBlobStrict : copyBlob,\n dataView: strict ? copyDataViewStrict : copyDataView,\n date: strict ? copyDateStrict : copyDate,\n error: copySelf,\n generator: copySelf,\n map: strict ? copyMapStrict : copyMap,\n object: strict ? copyObjectStrict : copyObject,\n regExp: strict ? copyRegExpStrict : copyRegExp,\n set: strict ? copySetStrict : copySet,\n };\n\n const methods = methodsOverride ? Object.assign(defaultMethods, methodsOverride) : defaultMethods;\n const copiers = getTagSpecificCopiers(methods, strict);\n const createCache = createCacheOverride || createDefaultCache;\n\n // Extra safety check to ensure that object and array copiers are always provided,\n // avoiding runtime errors.\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n if (!copiers.Object || !copiers.Array) {\n throw new Error('An object and array copier must be provided.');\n }\n\n return {\n createCache,\n copiers,\n maxDepth: maxDepth == null ? DEFAULT_MAX_DEPTH : maxDepth,\n methods,\n strict: Boolean(strict),\n };\n}\n\n/**\n * Get the copiers used for each specific object tag.\n */\nexport function getTagSpecificCopiers(methods: Required<CopierMethods>, strict: boolean | undefined): Copiers {\n const copyPrimitive = strict ? copyPrimitiveWrapperStrict : copyPrimitiveWrapper;\n\n // A `null` prototype is used so that a value carrying a custom `Symbol.toStringTag`\n // cannot resolve to an inherited `Object.prototype` member as its copier. Without it,\n // a tag such as `toString` or `valueOf` finds a function on the prototype chain and\n // that function is invoked in place of a real copier.\n return Object.assign(Object.create(null) as Copiers, {\n Arguments: methods.object,\n Array: methods.array,\n ArrayBuffer: methods.arrayBuffer,\n AsyncGenerator: methods.asyncGenerator,\n BigInt64Array: methods.arrayBuffer,\n BigUint64Array: methods.arrayBuffer,\n Blob: methods.blob,\n Boolean: copyPrimitive,\n DataView: methods.dataView,\n Date: methods.date,\n Error: methods.error,\n Float32Array: methods.arrayBuffer,\n Float64Array: methods.arrayBuffer,\n Generator: methods.generator,\n Int8Array: methods.arrayBuffer,\n Int16Array: methods.arrayBuffer,\n Int32Array: methods.arrayBuffer,\n Map: methods.map,\n Number: copyPrimitive,\n Object: methods.object,\n Promise: copySelf,\n RegExp: methods.regExp,\n Set: methods.set,\n SharedArrayBuffer: methods.arrayBuffer,\n String: strict ? copyStringStrict : copyPrimitiveWrapper,\n WeakMap: copySelf,\n WeakSet: copySelf,\n Uint8Array: methods.arrayBuffer,\n Uint8ClampedArray: methods.arrayBuffer,\n Uint16Array: methods.arrayBuffer,\n Uint32Array: methods.arrayBuffer,\n });\n}\n","import type { State } from './copier.ts';\nimport { getOptions } from './options.js';\nimport type { CreateCopierOptions } from './options.ts';\nimport { getTag, MaxDepthExceededError } from './utils.js';\n\nexport type { State } from './copier.ts';\nexport type { CreateCopierOptions } from './options.ts';\nexport { MaxDepthExceededError } from './utils.js';\n\n/**\n * Create a custom copier based on custom options for any of the following:\n * - `createCache` method to create a cache for copied objects\n * - custom copier `methods` for specific object types\n * - `strict` mode to copy all properties with their descriptors\n */\nexport function createCopier(options: CreateCopierOptions = {}) {\n const { createCache, copiers, maxDepth } = getOptions(options);\n const { Array: copyArray, Object: copyObject } = copiers;\n\n function copier(value: any, state: State): any {\n state.prototype = state.Constructor = undefined;\n\n if (!value || typeof value !== 'object') {\n return value;\n }\n\n if (state.cache.has(value)) {\n return state.cache.get(value);\n }\n\n // Bound the traversal of nested objects, so that values nested more deeply than the\n // call stack can handle fail with a descriptive error instead of a raw `RangeError`.\n if (++state.depth > maxDepth) {\n throw new MaxDepthExceededError(maxDepth);\n }\n\n state.prototype = Object.getPrototypeOf(value);\n // Using logical AND for speed, since optional chaining transforms to\n // a local variable usage.\n // eslint-disable-next-line @typescript-eslint/prefer-optional-chain\n state.Constructor = state.prototype && state.prototype.constructor;\n\n let clone: any;\n\n // plain objects\n if (!state.Constructor || state.Constructor === Object) {\n clone = copyObject(value as Record<string, any>, state);\n } else if (Array.isArray(value)) {\n // arrays\n clone = copyArray(value, state);\n } else {\n const tagSpecificCopier = copiers[getTag(value)];\n\n if (tagSpecificCopier) {\n clone = tagSpecificCopier(value, state);\n } else {\n clone = typeof value.then === 'function' ? value : copyObject(value as Record<string, any>, state);\n }\n }\n\n --state.depth;\n\n return clone;\n }\n\n return function copy<Value>(value: Value): Value {\n return copier(value, {\n Constructor: undefined,\n cache: createCache(),\n copier,\n depth: 0,\n prototype: undefined,\n });\n };\n}\n\n/**\n * Copy an value deeply as much as possible, where strict recreation of object properties\n * are maintained. All properties (including non-enumerable ones) are copied with their\n * original property descriptors on both objects and arrays.\n */\nexport const copyStrict = createCopier({ strict: true });\n\n/**\n * Copy an value deeply as much as possible.\n */\nexport const copy = createCopier();\n"],"names":[],"mappings":"AAMA;;;;;;AAMG;AACG,MAAO,qBAAsB,SAAQ,UAAU,CAAA;AAGnD,IAAA,W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EAAE;AAEvD;;AAEG;AACI,MAAM,IAAI,GAAG,YAAY;;"}
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../../src/utils.ts","../../../src/copier.ts","../../../src/options.ts","../../../src/index.ts"],"sourcesContent":["export interface Cache {\n has: (value: any) => boolean;\n set: (key: any, value: any) => void;\n get: (key: any) => any;\n}\n\n/**\n * Error thrown when the copier traverses deeper than the configured `maxDepth`.\n *\n * @note\n * Extends `RangeError` for backwards compatibility, since exceeding the maximum depth\n * previously surfaced as a native `RangeError` from stack exhaustion.\n */\nexport class MaxDepthExceededError extends RangeError {\n readonly maxDepth: number;\n\n constructor(maxDepth: number) {\n super(`Maximum copy depth of ${String(maxDepth)} exceeded; the value copied is nested too deeply.`);\n\n this.maxDepth = maxDepth;\n this.name = 'MaxDepthExceededError';\n }\n}\n\n// eslint-disable-next-line @typescript-eslint/unbound-method\nconst toStringFunction = Function.prototype.toString;\n// eslint-disable-next-line @typescript-eslint/unbound-method\nconst toStringObject = Object.prototype.toString;\n\n/**\n * Get an empty version of the object with the same prototype it has.\n */\nexport function getCleanClone(prototype: any): any {\n if (!prototype) {\n return Object.create(null);\n }\n\n const Constructor = prototype.constructor;\n\n if (Constructor === Object) {\n return prototype === Object.prototype ? {} : Object.create(prototype as object | null);\n }\n\n // 2026-10-10: Prototype constructor properties may contain ordinary data.\n if (typeof Constructor === 'function' && ~toStringFunction.call(Constructor).indexOf('[native code]')) {\n try {\n return new Constructor();\n } catch {\n // Ignore\n }\n }\n\n return Object.create(prototype as object | null);\n}\n\n/**\n * Get the tag of the value passed, so that the correct copier can be used.\n */\nexport function getTag(value: any): string {\n const stringTag = value[Symbol.toStringTag];\n\n if (stringTag) {\n return stringTag;\n }\n\n const type = toStringObject.call(value);\n\n return type.substring(8, type.length - 1);\n}\n","import { getCleanClone, getTag } from './utils.js';\nimport type { Cache } from './utils.ts';\n\nexport type InternalCopier<Value> = (value: Value, state: State) => Value;\n\nexport interface State {\n /**\n * The constructor of the value currently being copied, derived from its `prototype`.\n * Used to construct the clone for values that are not plain objects, such as subclasses\n * of `Array` or custom classes.\n *\n * @note\n * This is `undefined` for primitives and for values already present in the `cache`. It is\n * also reassigned for every value copied, so it must be read before any recursive\n * `copier` call is made, not after.\n */\n Constructor: any;\n /**\n * The cache of values already copied, mapping each original to its clone. Copiers should\n * populate it with the clone _before_ copying that value's contents, so that circular\n * references resolve to the clone rather than recursing infinitely.\n */\n cache: Cache;\n /**\n * The copier used for nested values. Call it as `state.copier(value, state)` to deeply\n * copy the contents of the value being copied.\n */\n copier: InternalCopier<any>;\n /**\n * The number of nested objects currently being copied, used to bound traversal of\n * deeply-nested values before the call stack is exhausted.\n *\n * @note\n * This is maintained by the copier itself; custom methods should not modify it.\n */\n depth: number;\n /**\n * The prototype of the value currently being copied, used to create a clone that\n * maintains the original's prototype chain.\n *\n * @note\n * This is `undefined` for primitives and for values already present in the `cache`. It is\n * also reassigned for every value copied, so it must be read before any recursive\n * `copier` call is made, not after.\n */\n prototype: any;\n}\n\n/**\n * The shared `%TypedArray%.prototype.slice`, which every typed array inherits.\n *\n * @note\n * This is used instead of the `slice` found on the value itself because subclasses can\n * override it with one that does not copy. `Buffer` is the notable case: its `slice`\n * returns a view over the same memory, so copying through it would alias the original.\n */\nconst sliceTypedArray = Object.getPrototypeOf(Int8Array.prototype).slice as (\n this: ArrayBufferView,\n start: number,\n) => ArrayBufferView;\n\n/**\n * Copy the descriptor from the original value to the clone.\n */\nfunction copyOwnDescriptor<Value extends object>(\n original: Value,\n clone: Value,\n property: string | symbol,\n state: State,\n): void {\n const ownDescriptor = Object.getOwnPropertyDescriptor(original, property) || {\n configurable: true,\n enumerable: true,\n value: original[property as keyof Value],\n writable: true,\n };\n const descriptor =\n ownDescriptor.get || ownDescriptor.set\n ? ownDescriptor\n : {\n configurable: ownDescriptor.configurable,\n enumerable: ownDescriptor.enumerable,\n value: state.copier(ownDescriptor.value, state),\n writable: ownDescriptor.writable,\n };\n\n try {\n Object.defineProperty(clone, property, descriptor);\n } catch {\n // The above can fail on node in extreme edge cases, so fall back to the loose assignment.\n clone[property as keyof Value] = descriptor.get ? descriptor.get() : descriptor.value;\n }\n}\n\n/**\n * Define the value as a standard (configurable, enumerable, writable) own property of the clone.\n */\nfunction defineOwnValue(clone: object, property: string | symbol, value: unknown): void {\n Object.defineProperty(clone, property, {\n configurable: true,\n enumerable: true,\n value,\n writable: true,\n });\n}\n\n/**\n * Strictly copy all properties contained on the object, starting with the name at the `start` index.\n *\n * @note\n * `Object.getOwnPropertyNames` lists integer keys first in ascending order, so array-like values\n * whose indices are already copied can pass their count as `start` to skip them.\n */\nfunction copyOwnPropertiesStrict<Value extends object>(\n value: Value,\n clone: Value,\n state: State,\n names: string[],\n start: number,\n): Value {\n for (let index = start; index < names.length; ++index) {\n copyOwnDescriptor(value, clone, names[index]!, state);\n }\n\n for (const symbol of Object.getOwnPropertySymbols(value)) {\n copyOwnDescriptor(value, clone, symbol, state);\n }\n\n return clone;\n}\n\n/**\n * Deeply copy the indexed values in the array.\n */\nexport function copyArray<Value extends any[]>(array: Value, state: State): Value {\n const clone = new state.Constructor();\n\n // set in the cache immediately to be able to reuse the object recursively\n state.cache.set(array, clone);\n\n for (let index = 0; index < array.length; ++index) {\n clone[index] = state.copier(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 function copyArrayStrict<Value extends any[]>(array: Value, state: State): Value {\n const clone = new state.Constructor() 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 // Indices are copied by descriptor rather than by assignment, unlike typed arrays and strings,\n // because array indices can be holes, accessors, or non-writable / non-enumerable values.\n return copyOwnPropertiesStrict(array, clone, state, Object.getOwnPropertyNames(array), 0);\n}\n\n/**\n * Copy the contents of the ArrayBuffer, or of the typed array viewing one.\n *\n * @note\n * `slice` always returns a fixed-length buffer, so a resizable or growable buffer that can change\n * size is instead constructed with the same `maxByteLength` and has its contents copied in.\n */\nexport function copyArrayBuffer<Value extends ArrayBufferLike | ArrayBufferView>(\n arrayBuffer: Value,\n state: State,\n): Value {\n if (ArrayBuffer.isView(arrayBuffer)) {\n return sliceTypedArray.call(arrayBuffer, 0) as Value;\n }\n\n if ((arrayBuffer as ArrayBuffer).resizable || (arrayBuffer as SharedArrayBuffer).growable) {\n const maxByteLength = (arrayBuffer as ArrayBuffer).maxByteLength;\n const clone = new state.Constructor(arrayBuffer.byteLength, { maxByteLength });\n\n // The new buffer is zero-filled, and buffers can only be read or written through a view, so\n // copy the original's bytes into it through byte-level views of both. Without this, the clone\n // would have the right size but be all zeros.\n new Uint8Array(clone).set(new Uint8Array(arrayBuffer));\n\n return clone as Value;\n }\n\n // V8 throws when slicing an empty, fixed-length SharedArrayBuffer.\n if (!arrayBuffer.byteLength && getTag(arrayBuffer) === 'SharedArrayBuffer') {\n return new state.Constructor(0) as Value;\n }\n\n return arrayBuffer.slice(0) as Value;\n}\n\n/**\n * Copy the contents of the ArrayBuffer, or of the typed array viewing one, as well as\n * any custom properties.\n */\nexport function copyArrayBufferStrict<Value extends ArrayBufferLike | ArrayBufferView>(\n arrayBuffer: Value,\n state: State,\n): Value {\n const clone = copyArrayBuffer(arrayBuffer, state);\n\n // set in the cache immediately to be able to reuse the object recursively\n state.cache.set(arrayBuffer, clone);\n\n // Typed arrays list their indices first, but unlike arrays have no own `length` to skip. The\n // fresh clone is read, since the original may have an own `length` that shadows the real one.\n const start = ArrayBuffer.isView(clone) ? (clone as unknown as ArrayLike<unknown>).length || 0 : 0;\n\n return copyOwnPropertiesStrict(arrayBuffer, clone, state, Object.getOwnPropertyNames(arrayBuffer), start);\n}\n\n/**\n * Create a new Blob with the contents of the original.\n */\nexport function copyBlob<Value extends Blob>(blob: Value, _state: State): Value {\n return blob.slice(0, blob.size, blob.type) as Value;\n}\n\n/**\n * Create a new Blob with the contents of the original, and copy any custom properties.\n */\nexport const copyBlobStrict = createStrictHandler(copyBlob);\n\n/**\n * Create a new DataView with the contents of the original.\n */\nexport function copyDataView<Value extends DataView>(dataView: Value, state: State): Value {\n return new state.Constructor(state.copier(dataView.buffer, state), dataView.byteOffset, dataView.byteLength);\n}\n\n/**\n * Create a new DataView with the contents of the original, and copy any custom properties.\n *\n * @note\n * The buffer is shared with any other reference to it in the value being copied, and has\n * its own custom properties copied, the same as if it were reached directly.\n */\nexport function copyDataViewStrict<Value extends DataView>(dataView: Value, state: State): Value {\n const { buffer } = dataView;\n const { cache, Constructor } = state;\n const bufferCopied = cache.has(buffer);\n const bufferClone = bufferCopied ? cache.get(buffer) : state.copier(buffer, state);\n\n // The buffer's custom properties may reference this DataView, in which case copying the buffer\n // already created and cached its clone. Reuse it so that every reference resolves to one clone.\n if (!bufferCopied && cache.has(dataView)) {\n return cache.get(dataView);\n }\n\n const clone = new Constructor(bufferClone, dataView.byteOffset, dataView.byteLength) as Value;\n\n // set in the cache immediately to be able to reuse the object recursively.\n state.cache.set(dataView, clone);\n\n return copyOwnPropertiesStrict(dataView, clone, state, Object.getOwnPropertyNames(dataView), 0);\n}\n\n/**\n * Create a new Date based on the time of the original.\n */\nexport function copyDate<Value extends Date>(date: Value, state: State): Value {\n return new state.Constructor(date.getTime());\n}\n\n/**\n * Create a new Date based on the time of the original, and copy any custom properties.\n */\nexport const copyDateStrict = createStrictHandler(copyDate);\n\n/**\n * Deeply copy the keys and values of the original.\n */\nexport function copyMap<Value extends Map<any, any>>(map: Value, state: State): Value {\n const clone = new state.Constructor() 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 for (const [key, value] of map) {\n clone.set(key, state.copier(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 function copyMapStrict<Value extends Map<any, any>>(map: Value, state: State): Value {\n return copyOwnPropertiesStrict(map, copyMap(map, state), state, Object.getOwnPropertyNames(map), 0);\n}\n\n/**\n * Deeply copy the properties (keys and symbols) and values of the original.\n *\n * @note\n * Values are assigned for performance, but assignment respects the prototype chain, so it throws\n * when the key shadows an inherited read-only or getter-only property. In that case the value is\n * defined directly, still producing the standard own property expected in loose mode. This relies\n * on the source running in strict mode, where a failed assignment throws instead of being silently\n * ignored.\n */\nexport function copyObject<Value extends Record<string, any>>(object: Value, state: State): Value {\n const clone: Record<string | symbol, unknown> = getCleanClone(state.prototype);\n\n // set in the cache immediately to be able to reuse the object recursively\n state.cache.set(object, clone);\n\n for (const key of Object.keys(object)) {\n const value = state.copier(object[key], state);\n\n if (key === '__proto__') {\n // Native assignment would attempt to use `Object.setPropertyOf` under the hood, when this\n // property has been explicitly set as a standard property. Using `defineProperty` ensures\n // its treatment in the clone is unchanged from the source.\n defineOwnValue(clone, key, value);\n } else {\n try {\n clone[key] = value;\n } catch {\n defineOwnValue(clone, key, value);\n }\n }\n }\n\n for (const symbol of Object.getOwnPropertySymbols(object)) {\n // Only copy enumerable symbols in loose mode, to align with handling of `keys`.\n if (Object.prototype.propertyIsEnumerable.call(object, symbol)) {\n const value = state.copier((object as any)[symbol], state);\n\n try {\n clone[symbol] = value;\n } catch {\n defineOwnValue(clone, symbol, value);\n }\n }\n }\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 function copyObjectStrict<Value extends Record<string, any>>(object: Value, state: State): Value {\n const clone = getCleanClone(state.prototype);\n\n // set in the cache immediately to be able to reuse the object recursively\n state.cache.set(object, clone);\n\n return copyOwnPropertiesStrict(object, clone, state, Object.getOwnPropertyNames(object), 0);\n}\n\n/**\n * Create a new primitive wrapper from the value of the original.\n */\nexport function copyPrimitiveWrapper<\n // Specifically use the object constructor types\n // eslint-disable-next-line @typescript-eslint/no-wrapper-object-types\n Value extends Boolean | Number | String,\n>(primitiveObject: Value, state: State): Value {\n return new state.Constructor(primitiveObject.valueOf());\n}\n\n/**\n * Create a new primitive wrapper from the value of the original, and copy any\n * custom properties.\n */\nexport const copyPrimitiveWrapperStrict = createStrictHandler(copyPrimitiveWrapper);\n\n/**\n * Create a new RegExp based on the value and flags of the original.\n */\nexport function copyRegExp<Value extends RegExp>(regExp: Value, state: State): Value {\n const clone = new state.Constructor(regExp.source, regExp.flags) as Value;\n\n // `lastIndex` is not retained when constructing anew, so manually copy it.\n clone.lastIndex = regExp.lastIndex;\n\n return clone;\n}\n\n/**\n * Copy the original RegExp, as well as any custom properties.\n */\nexport const copyRegExpStrict = createStrictHandler(copyRegExp);\n\n/**\n * Return the original value (an identity function).\n *\n * @note\n * THis is used for objects that cannot be copied, such as WeakMap.\n */\nexport function copySelf<Value>(value: Value, _state: State): Value {\n return value;\n}\n\n/**\n * Deeply copy the values of the original.\n */\nexport function copySet<Value extends Set<any>>(set: Value, state: State): Value {\n const clone = new state.Constructor() 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 for (const value of set) {\n clone.add(state.copier(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 function copySetStrict<Value extends Set<any>>(set: Value, state: State): Value {\n return copyOwnPropertiesStrict(set, copySet(set, state), state, Object.getOwnPropertyNames(set), 0);\n}\n\n/**\n * Copy the original value based on the handler passed, and also copy custom properties.\n *\n * @note\n * The handlers used here have no nested values to copy, so they skip the cache to keep loose\n * copies fast. Custom properties can reference the value itself, so the clone is cached here\n * before they are copied.\n */\nfunction createStrictHandler<Value extends object>(handler: (value: Value, state: State) => Value) {\n return (value: Value, state: State): Value => {\n const clone = handler(value, state);\n\n // set in the cache immediately to be able to reuse the object recursively\n state.cache.set(value, clone);\n\n return copyOwnPropertiesStrict(value, clone, state, Object.getOwnPropertyNames(value), 0);\n };\n}\n\n/**\n * Create a new String wrapper from the value of the original, and copy custom properties.\n */\n// `String` primitive constructor is intentional.\n// eslint-disable-next-line @typescript-eslint/no-wrapper-object-types\nexport function copyStringStrict<Value extends String>(string: Value, state: State): Value {\n const clone = copyPrimitiveWrapper(string, state);\n\n // set in the cache immediately to be able to reuse the object recursively\n state.cache.set(string, clone);\n\n const { length } = string;\n const names = Object.getOwnPropertyNames(string);\n // Custom integer keys beyond the string's length are listed before `length`, so only skip\n // `length` when it directly follows the characters.\n const start = names[length] === 'length' ? length + 1 : length;\n\n return copyOwnPropertiesStrict(string, clone, state, names, start);\n}\n","import {\n copyArrayBuffer,\n copyArrayBufferStrict,\n copyArray,\n copyArrayStrict,\n copyBlob,\n copyBlobStrict,\n copyDataView,\n copyDataViewStrict,\n copyDate,\n copyDateStrict,\n copyMap,\n copyMapStrict,\n copyObject,\n copyObjectStrict,\n copyPrimitiveWrapper,\n copyPrimitiveWrapperStrict,\n copyRegExp,\n copyRegExpStrict,\n copySelf,\n copySet,\n copySetStrict,\n copyStringStrict,\n} from './copier.js';\nimport type { InternalCopier } from './copier.ts';\nimport type { Cache } from './utils.ts';\n\nexport interface CopierMethods {\n array?: InternalCopier<any[]>;\n arrayBuffer?: InternalCopier<ArrayBuffer>;\n asyncGenerator?: InternalCopier<AsyncGenerator>;\n blob?: InternalCopier<Blob>;\n dataView?: InternalCopier<DataView>;\n date?: InternalCopier<Date>;\n error?: InternalCopier<Error>;\n generator?: InternalCopier<Generator>;\n map?: InternalCopier<Map<any, any>>;\n object?: InternalCopier<Record<string, any>>;\n regExp?: InternalCopier<RegExp>;\n set?: InternalCopier<Set<any>>;\n}\n\ninterface Copiers {\n [key: string]: InternalCopier<any> | undefined;\n\n Arguments: InternalCopier<Record<string, any>>;\n Array: InternalCopier<any[]>;\n ArrayBuffer: InternalCopier<ArrayBuffer>;\n AsyncGenerator: InternalCopier<AsyncGenerator>;\n BigInt64Array: InternalCopier<ArrayBuffer>;\n BigUint64Array: InternalCopier<ArrayBuffer>;\n Blob: InternalCopier<Blob>;\n // eslint-disable-next-line @typescript-eslint/no-wrapper-object-types\n Boolean: InternalCopier<Boolean>;\n DataView: InternalCopier<DataView>;\n Date: InternalCopier<Date>;\n Error: InternalCopier<Error>;\n Float32Array: InternalCopier<ArrayBuffer>;\n Float64Array: InternalCopier<ArrayBuffer>;\n Generator: InternalCopier<Generator>;\n Int8Array: InternalCopier<ArrayBuffer>;\n Int16Array: InternalCopier<ArrayBuffer>;\n Int32Array: InternalCopier<ArrayBuffer>;\n Map: InternalCopier<Map<any, any>>;\n // eslint-disable-next-line @typescript-eslint/no-wrapper-object-types\n Number: InternalCopier<Number>;\n Object: InternalCopier<Record<string, any>>;\n Promise: InternalCopier<Promise<any>>;\n RegExp: InternalCopier<RegExp>;\n Set: InternalCopier<Set<any>>;\n SharedArrayBuffer: InternalCopier<SharedArrayBuffer>;\n // eslint-disable-next-line @typescript-eslint/no-wrapper-object-types\n String: InternalCopier<String>;\n WeakMap: InternalCopier<WeakMap<any, any>>;\n WeakSet: InternalCopier<WeakSet<any>>;\n Uint8Array: InternalCopier<ArrayBuffer>;\n Uint8ClampedArray: InternalCopier<ArrayBuffer>;\n Uint16Array: InternalCopier<ArrayBuffer>;\n Uint32Array: InternalCopier<ArrayBuffer>;\n}\n\nexport interface CreateCopierOptions {\n /**\n * Creates the cache used to track values already copied, which is what allows circular\n * references to resolve to their clone instead of recursing infinitely. A new cache is\n * created for each top-level copy. Since it only needs to satisfy the `has` / `get` /\n * `set` contract, a bounded implementation such as an LRU cache can be used to trade\n * circular reference handling for a smaller memory footprint.\n *\n * @default () => new WeakMap()\n */\n createCache?: () => Cache;\n /**\n * The maximum number of nested objects to traverse before throwing a\n * `MaxDepthExceededError`. Pass `Infinity` to traverse without a limit.\n *\n * @default 1000\n */\n maxDepth?: number;\n /**\n * Overrides of the copiers used for specific object types, allowing custom copy\n * semantics for those types. Any type not overridden uses its default copier. Each\n * method receives the value to copy and the current `State`, and is responsible for\n * populating `state.cache` and recursing via `state.copier` if it wants circular\n * reference handling and deep copies respectively.\n */\n methods?: CopierMethods;\n /**\n * Copies all own properties with their original property descriptors, including\n * non-enumerable properties, symbols, and non-index properties on arrays.\n *\n * @note\n * This is significantly slower than the default \"loose\" copy, so it should only be used\n * when the exact shape of the original must be replicated.\n *\n * @default false\n */\n strict?: boolean;\n}\n\nexport interface RequiredCreateCopierOptions extends Omit<Required<CreateCopierOptions>, 'methods'> {\n copiers: Copiers;\n methods: Required<CopierMethods>;\n}\n\n/**\n * The maximum depth traversed when none is provided.\n *\n * @note\n * This is deliberately below the depth at which the native call stack is exhausted\n * (~1875 for strict copies in node), so that untrusted, deeply-nested values fail with a\n * catchable, descriptive error instead of a raw `RangeError`.\n */\nexport const DEFAULT_MAX_DEPTH = 1000;\n\nexport function createDefaultCache(): Cache {\n return new WeakMap();\n}\n\nexport function getOptions({\n createCache: createCacheOverride,\n maxDepth,\n methods: methodsOverride,\n strict,\n}: CreateCopierOptions): RequiredCreateCopierOptions {\n const defaultMethods = {\n array: strict ? copyArrayStrict : copyArray,\n arrayBuffer: strict ? copyArrayBufferStrict : copyArrayBuffer,\n asyncGenerator: copySelf,\n blob: strict ? copyBlobStrict : copyBlob,\n dataView: strict ? copyDataViewStrict : copyDataView,\n date: strict ? copyDateStrict : copyDate,\n error: copySelf,\n generator: copySelf,\n map: strict ? copyMapStrict : copyMap,\n object: strict ? copyObjectStrict : copyObject,\n regExp: strict ? copyRegExpStrict : copyRegExp,\n set: strict ? copySetStrict : copySet,\n };\n\n const methods = methodsOverride ? Object.assign(defaultMethods, methodsOverride) : defaultMethods;\n const copiers = getTagSpecificCopiers(methods, strict);\n const createCache = createCacheOverride || createDefaultCache;\n\n // Extra safety check to ensure that object and array copiers are always provided,\n // avoiding runtime errors.\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n if (!copiers.Object || !copiers.Array) {\n throw new Error('An object and array copier must be provided.');\n }\n\n return {\n createCache,\n copiers,\n maxDepth: maxDepth == null ? DEFAULT_MAX_DEPTH : maxDepth,\n methods,\n strict: Boolean(strict),\n };\n}\n\n/**\n * Get the copiers used for each specific object tag.\n */\nexport function getTagSpecificCopiers(methods: Required<CopierMethods>, strict: boolean | undefined): Copiers {\n const copyPrimitive = strict ? copyPrimitiveWrapperStrict : copyPrimitiveWrapper;\n\n // A `null` prototype is used so that a value carrying a custom `Symbol.toStringTag`\n // cannot resolve to an inherited `Object.prototype` member as its copier. Without it,\n // a tag such as `toString` or `valueOf` finds a function on the prototype chain and\n // that function is invoked in place of a real copier.\n return Object.assign(Object.create(null) as Copiers, {\n Arguments: methods.object,\n Array: methods.array,\n ArrayBuffer: methods.arrayBuffer,\n AsyncGenerator: methods.asyncGenerator,\n BigInt64Array: methods.arrayBuffer,\n BigUint64Array: methods.arrayBuffer,\n Blob: methods.blob,\n Boolean: copyPrimitive,\n DataView: methods.dataView,\n Date: methods.date,\n Error: methods.error,\n Float32Array: methods.arrayBuffer,\n Float64Array: methods.arrayBuffer,\n Generator: methods.generator,\n Int8Array: methods.arrayBuffer,\n Int16Array: methods.arrayBuffer,\n Int32Array: methods.arrayBuffer,\n Map: methods.map,\n Number: copyPrimitive,\n Object: methods.object,\n Promise: copySelf,\n RegExp: methods.regExp,\n Set: methods.set,\n SharedArrayBuffer: methods.arrayBuffer,\n String: strict ? copyStringStrict : copyPrimitiveWrapper,\n WeakMap: copySelf,\n WeakSet: copySelf,\n Uint8Array: methods.arrayBuffer,\n Uint8ClampedArray: methods.arrayBuffer,\n Uint16Array: methods.arrayBuffer,\n Uint32Array: methods.arrayBuffer,\n });\n}\n","import type { State } from './copier.ts';\nimport { getOptions } from './options.js';\nimport type { CreateCopierOptions } from './options.ts';\nimport { getTag, MaxDepthExceededError } from './utils.js';\n\nexport type { State } from './copier.ts';\nexport type { CreateCopierOptions } from './options.ts';\nexport { MaxDepthExceededError } from './utils.js';\n\n/**\n * Create a custom copier based on custom options for any of the following:\n * - `createCache` method to create a cache for copied objects\n * - custom copier `methods` for specific object types\n * - `strict` mode to copy all properties with their descriptors\n */\nexport function createCopier(options: CreateCopierOptions = {}) {\n const { createCache, copiers, maxDepth } = getOptions(options);\n const { Array: copyArray, Object: copyObject } = copiers;\n\n function copier(value: any, state: State): any {\n state.prototype = state.Constructor = undefined;\n\n if (!value || typeof value !== 'object') {\n return value;\n }\n\n if (state.cache.has(value)) {\n return state.cache.get(value);\n }\n\n // Bound the traversal of nested objects, so that values nested more deeply than the\n // call stack can handle fail with a descriptive error instead of a raw `RangeError`.\n if (++state.depth > maxDepth) {\n throw new MaxDepthExceededError(maxDepth);\n }\n\n state.prototype = Object.getPrototypeOf(value);\n // Using logical AND for speed, since optional chaining transforms to\n // a local variable usage.\n // eslint-disable-next-line @typescript-eslint/prefer-optional-chain\n state.Constructor = state.prototype && state.prototype.constructor;\n\n let clone: any;\n\n // plain objects\n if (!state.Constructor || state.Constructor === Object) {\n clone = copyObject(value as Record<string, any>, state);\n } else if (Array.isArray(value)) {\n // arrays\n clone = copyArray(value, state);\n } else {\n const tagSpecificCopier = copiers[getTag(value)];\n\n if (tagSpecificCopier) {\n clone = tagSpecificCopier(value, state);\n } else {\n clone = typeof value.then === 'function' ? value : copyObject(value as Record<string, any>, state);\n }\n }\n\n --state.depth;\n\n return clone;\n }\n\n return function copy<Value>(value: Value): Value {\n return copier(value, {\n Constructor: undefined,\n cache: createCache(),\n copier,\n depth: 0,\n prototype: undefined,\n });\n };\n}\n\n/**\n * Copy an value deeply as much as possible, where strict recreation of object properties\n * are maintained. All properties (including non-enumerable ones) are copied with their\n * original property descriptors on both objects and arrays.\n */\nexport const copyStrict = createCopier({ strict: true });\n\n/**\n * Copy an value deeply as much as possible.\n */\nexport const copy = createCopier();\n"],"names":[],"mappings":"AAMA;;;;;;AAMG;AACG,MAAO,qBAAsB,SAAQ,UAAU,CAAA;AAGnD,IAAA,WAAA,CAAY,QAAgB,EAAA;QAC1B,KAAK,CAAC,yBAAyB,MAAM,CAAC,QAAQ,CAAC,CAAA,iDAAA,CAAmD,CAAC;AAEnG,QAAA,IAAI,CAAC,QAAQ,GAAG,QAAQ;AACxB,QAAA,IAAI,CAAC,IAAI,GAAG,uBAAuB;IACrC;AACD;AAED;AACA,MAAM,gBAAgB,GAAG,QAAQ,CAAC,SAAS,CAAC,QAAQ;AACp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B,SAAA,CAAC;AACJ,IAAA,CAAC;AACH;AAEA;;;;AAIG;AACI,MAAM,UAAU,GAAG,YAAY,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE;AAEvD;;AAEG;AACI,MAAM,IAAI,GAAG,YAAY;;"}
|
|
@@ -91,6 +91,17 @@
|
|
|
91
91
|
clone[property] = descriptor.get ? descriptor.get() : descriptor.value;
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
|
+
/**
|
|
95
|
+
* Define the value as a standard (configurable, enumerable, writable) own property of the clone.
|
|
96
|
+
*/
|
|
97
|
+
function defineOwnValue(clone, property, value) {
|
|
98
|
+
Object.defineProperty(clone, property, {
|
|
99
|
+
configurable: true,
|
|
100
|
+
enumerable: true,
|
|
101
|
+
value,
|
|
102
|
+
writable: true,
|
|
103
|
+
});
|
|
104
|
+
}
|
|
94
105
|
/**
|
|
95
106
|
* Strictly copy all properties contained on the object, starting with the name at the `start` index.
|
|
96
107
|
*
|
|
@@ -237,31 +248,45 @@
|
|
|
237
248
|
}
|
|
238
249
|
/**
|
|
239
250
|
* Deeply copy the properties (keys and symbols) and values of the original.
|
|
251
|
+
*
|
|
252
|
+
* @note
|
|
253
|
+
* Values are assigned for performance, but assignment respects the prototype chain, so it throws
|
|
254
|
+
* when the key shadows an inherited read-only or getter-only property. In that case the value is
|
|
255
|
+
* defined directly, still producing the standard own property expected in loose mode. This relies
|
|
256
|
+
* on the source running in strict mode, where a failed assignment throws instead of being silently
|
|
257
|
+
* ignored.
|
|
240
258
|
*/
|
|
241
259
|
function copyObject(object, state) {
|
|
242
260
|
const clone = getCleanClone(state.prototype);
|
|
243
261
|
// set in the cache immediately to be able to reuse the object recursively
|
|
244
262
|
state.cache.set(object, clone);
|
|
245
263
|
for (const key of Object.keys(object)) {
|
|
264
|
+
const value = state.copier(object[key], state);
|
|
246
265
|
if (key === '__proto__') {
|
|
247
266
|
// Native assignment would attempt to use `Object.setPropertyOf` under the hood, when this
|
|
248
267
|
// property has been explicitly set as a standard property. Using `defineProperty` ensures
|
|
249
268
|
// its treatment in the clone is unchanged from the source.
|
|
250
|
-
|
|
251
|
-
configurable: true,
|
|
252
|
-
enumerable: true,
|
|
253
|
-
value: state.copier(object[key], state),
|
|
254
|
-
writable: true,
|
|
255
|
-
});
|
|
269
|
+
defineOwnValue(clone, key, value);
|
|
256
270
|
}
|
|
257
271
|
else {
|
|
258
|
-
|
|
272
|
+
try {
|
|
273
|
+
clone[key] = value;
|
|
274
|
+
}
|
|
275
|
+
catch (_a) {
|
|
276
|
+
defineOwnValue(clone, key, value);
|
|
277
|
+
}
|
|
259
278
|
}
|
|
260
279
|
}
|
|
261
280
|
for (const symbol of Object.getOwnPropertySymbols(object)) {
|
|
262
281
|
// Only copy enumerable symbols in loose mode, to align with handling of `keys`.
|
|
263
282
|
if (Object.prototype.propertyIsEnumerable.call(object, symbol)) {
|
|
264
|
-
|
|
283
|
+
const value = state.copier(object[symbol], state);
|
|
284
|
+
try {
|
|
285
|
+
clone[symbol] = value;
|
|
286
|
+
}
|
|
287
|
+
catch (_b) {
|
|
288
|
+
defineOwnValue(clone, symbol, value);
|
|
289
|
+
}
|
|
265
290
|
}
|
|
266
291
|
}
|
|
267
292
|
return clone;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/utils.ts","../../../src/copier.ts","../../../src/options.ts","../../../src/index.ts"],"sourcesContent":["export interface Cache {\n has: (value: any) => boolean;\n set: (key: any, value: any) => void;\n get: (key: any) => any;\n}\n\n/**\n * Error thrown when the copier traverses deeper than the configured `maxDepth`.\n *\n * @note\n * Extends `RangeError` for backwards compatibility, since exceeding the maximum depth\n * previously surfaced as a native `RangeError` from stack exhaustion.\n */\nexport class MaxDepthExceededError extends RangeError {\n readonly maxDepth: number;\n\n constructor(maxDepth: number) {\n super(`Maximum copy depth of ${String(maxDepth)} exceeded; the value copied is nested too deeply.`);\n\n this.maxDepth = maxDepth;\n this.name = 'MaxDepthExceededError';\n }\n}\n\n// eslint-disable-next-line @typescript-eslint/unbound-method\nconst toStringFunction = Function.prototype.toString;\n// eslint-disable-next-line @typescript-eslint/unbound-method\nconst toStringObject = Object.prototype.toString;\n\n/**\n * Get an empty version of the object with the same prototype it has.\n */\nexport function getCleanClone(prototype: any): any {\n if (!prototype) {\n return Object.create(null);\n }\n\n const Constructor = prototype.constructor;\n\n if (Constructor === Object) {\n return prototype === Object.prototype ? {} : Object.create(prototype as object | null);\n }\n\n // 2026-10-10: Prototype constructor properties may contain ordinary data.\n if (typeof Constructor === 'function' && ~toStringFunction.call(Constructor).indexOf('[native code]')) {\n try {\n return new Constructor();\n } catch {\n // Ignore\n }\n }\n\n return Object.create(prototype as object | null);\n}\n\n/**\n * Get the tag of the value passed, so that the correct copier can be used.\n */\nexport function getTag(value: any): string {\n const stringTag = value[Symbol.toStringTag];\n\n if (stringTag) {\n return stringTag;\n }\n\n const type = toStringObject.call(value);\n\n return type.substring(8, type.length - 1);\n}\n","import { getCleanClone, getTag } from './utils.js';\nimport type { Cache } from './utils.ts';\n\nexport type InternalCopier<Value> = (value: Value, state: State) => Value;\n\nexport interface State {\n /**\n * The constructor of the value currently being copied, derived from its `prototype`.\n * Used to construct the clone for values that are not plain objects, such as subclasses\n * of `Array` or custom classes.\n *\n * @note\n * This is `undefined` for primitives and for values already present in the `cache`. It is\n * also reassigned for every value copied, so it must be read before any recursive\n * `copier` call is made, not after.\n */\n Constructor: any;\n /**\n * The cache of values already copied, mapping each original to its clone. Copiers should\n * populate it with the clone _before_ copying that value's contents, so that circular\n * references resolve to the clone rather than recursing infinitely.\n */\n cache: Cache;\n /**\n * The copier used for nested values. Call it as `state.copier(value, state)` to deeply\n * copy the contents of the value being copied.\n */\n copier: InternalCopier<any>;\n /**\n * The number of nested objects currently being copied, used to bound traversal of\n * deeply-nested values before the call stack is exhausted.\n *\n * @note\n * This is maintained by the copier itself; custom methods should not modify it.\n */\n depth: number;\n /**\n * The prototype of the value currently being copied, used to create a clone that\n * maintains the original's prototype chain.\n *\n * @note\n * This is `undefined` for primitives and for values already present in the `cache`. It is\n * also reassigned for every value copied, so it must be read before any recursive\n * `copier` call is made, not after.\n */\n prototype: any;\n}\n\n/**\n * The shared `%TypedArray%.prototype.slice`, which every typed array inherits.\n *\n * @note\n * This is used instead of the `slice` found on the value itself because subclasses can\n * override it with one that does not copy. `Buffer` is the notable case: its `slice`\n * returns a view over the same memory, so copying through it would alias the original.\n */\nconst sliceTypedArray = Object.getPrototypeOf(Int8Array.prototype).slice as (\n this: ArrayBufferView,\n start: number,\n) => ArrayBufferView;\n\n/**\n * Copy the descriptor from the original value to the clone.\n */\nfunction copyOwnDescriptor<Value extends object>(\n original: Value,\n clone: Value,\n property: string | symbol,\n state: State,\n): void {\n const ownDescriptor = Object.getOwnPropertyDescriptor(original, property) || {\n configurable: true,\n enumerable: true,\n value: original[property as keyof Value],\n writable: true,\n };\n const descriptor =\n ownDescriptor.get || ownDescriptor.set\n ? ownDescriptor\n : {\n configurable: ownDescriptor.configurable,\n enumerable: ownDescriptor.enumerable,\n value: state.copier(ownDescriptor.value, state),\n writable: ownDescriptor.writable,\n };\n\n try {\n Object.defineProperty(clone, property, descriptor);\n } catch {\n // The above can fail on node in extreme edge cases, so fall back to the loose assignment.\n clone[property as keyof Value] = descriptor.get ? descriptor.get() : descriptor.value;\n }\n}\n\n/**\n * Strictly copy all properties contained on the object, starting with the name at the `start` index.\n *\n * @note\n * `Object.getOwnPropertyNames` lists integer keys first in ascending order, so array-like values\n * whose indices are already copied can pass their count as `start` to skip them.\n */\nfunction copyOwnPropertiesStrict<Value extends object>(\n value: Value,\n clone: Value,\n state: State,\n names: string[],\n start: number,\n): Value {\n for (let index = start; index < names.length; ++index) {\n copyOwnDescriptor(value, clone, names[index]!, state);\n }\n\n for (const symbol of Object.getOwnPropertySymbols(value)) {\n copyOwnDescriptor(value, clone, symbol, state);\n }\n\n return clone;\n}\n\n/**\n * Deeply copy the indexed values in the array.\n */\nexport function copyArray<Value extends any[]>(array: Value, state: State): Value {\n const clone = new state.Constructor();\n\n // set in the cache immediately to be able to reuse the object recursively\n state.cache.set(array, clone);\n\n for (let index = 0; index < array.length; ++index) {\n clone[index] = state.copier(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 function copyArrayStrict<Value extends any[]>(array: Value, state: State): Value {\n const clone = new state.Constructor() 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 // Indices are copied by descriptor rather than by assignment, unlike typed arrays and strings,\n // because array indices can be holes, accessors, or non-writable / non-enumerable values.\n return copyOwnPropertiesStrict(array, clone, state, Object.getOwnPropertyNames(array), 0);\n}\n\n/**\n * Copy the contents of the ArrayBuffer, or of the typed array viewing one.\n *\n * @note\n * `slice` always returns a fixed-length buffer, so a resizable or growable buffer that can change\n * size is instead constructed with the same `maxByteLength` and has its contents copied in.\n */\nexport function copyArrayBuffer<Value extends ArrayBufferLike | ArrayBufferView>(\n arrayBuffer: Value,\n state: State,\n): Value {\n if (ArrayBuffer.isView(arrayBuffer)) {\n return sliceTypedArray.call(arrayBuffer, 0) as Value;\n }\n\n if ((arrayBuffer as ArrayBuffer).resizable || (arrayBuffer as SharedArrayBuffer).growable) {\n const maxByteLength = (arrayBuffer as ArrayBuffer).maxByteLength;\n const clone = new state.Constructor(arrayBuffer.byteLength, { maxByteLength });\n\n // The new buffer is zero-filled, and buffers can only be read or written through a view, so\n // copy the original's bytes into it through byte-level views of both. Without this, the clone\n // would have the right size but be all zeros.\n new Uint8Array(clone).set(new Uint8Array(arrayBuffer));\n\n return clone as Value;\n }\n\n // V8 throws when slicing an empty, fixed-length SharedArrayBuffer.\n if (!arrayBuffer.byteLength && getTag(arrayBuffer) === 'SharedArrayBuffer') {\n return new state.Constructor(0) as Value;\n }\n\n return arrayBuffer.slice(0) as Value;\n}\n\n/**\n * Copy the contents of the ArrayBuffer, or of the typed array viewing one, as well as\n * any custom properties.\n */\nexport function copyArrayBufferStrict<Value extends ArrayBufferLike | ArrayBufferView>(\n arrayBuffer: Value,\n state: State,\n): Value {\n const clone = copyArrayBuffer(arrayBuffer, state);\n\n // set in the cache immediately to be able to reuse the object recursively\n state.cache.set(arrayBuffer, clone);\n\n // Typed arrays list their indices first, but unlike arrays have no own `length` to skip. The\n // fresh clone is read, since the original may have an own `length` that shadows the real one.\n const start = ArrayBuffer.isView(clone) ? (clone as unknown as ArrayLike<unknown>).length || 0 : 0;\n\n return copyOwnPropertiesStrict(arrayBuffer, clone, state, Object.getOwnPropertyNames(arrayBuffer), start);\n}\n\n/**\n * Create a new Blob with the contents of the original.\n */\nexport function copyBlob<Value extends Blob>(blob: Value, _state: State): Value {\n return blob.slice(0, blob.size, blob.type) as Value;\n}\n\n/**\n * Create a new Blob with the contents of the original, and copy any custom properties.\n */\nexport const copyBlobStrict = createStrictHandler(copyBlob);\n\n/**\n * Create a new DataView with the contents of the original.\n */\nexport function copyDataView<Value extends DataView>(dataView: Value, state: State): Value {\n return new state.Constructor(state.copier(dataView.buffer, state), dataView.byteOffset, dataView.byteLength);\n}\n\n/**\n * Create a new DataView with the contents of the original, and copy any custom properties.\n *\n * @note\n * The buffer is shared with any other reference to it in the value being copied, and has\n * its own custom properties copied, the same as if it were reached directly.\n */\nexport function copyDataViewStrict<Value extends DataView>(dataView: Value, state: State): Value {\n const { buffer } = dataView;\n const { cache, Constructor } = state;\n const bufferCopied = cache.has(buffer);\n const bufferClone = bufferCopied ? cache.get(buffer) : state.copier(buffer, state);\n\n // The buffer's custom properties may reference this DataView, in which case copying the buffer\n // already created and cached its clone. Reuse it so that every reference resolves to one clone.\n if (!bufferCopied && cache.has(dataView)) {\n return cache.get(dataView);\n }\n\n const clone = new Constructor(bufferClone, dataView.byteOffset, dataView.byteLength) as Value;\n\n // set in the cache immediately to be able to reuse the object recursively.\n state.cache.set(dataView, clone);\n\n return copyOwnPropertiesStrict(dataView, clone, state, Object.getOwnPropertyNames(dataView), 0);\n}\n\n/**\n * Create a new Date based on the time of the original.\n */\nexport function copyDate<Value extends Date>(date: Value, state: State): Value {\n return new state.Constructor(date.getTime());\n}\n\n/**\n * Create a new Date based on the time of the original, and copy any custom properties.\n */\nexport const copyDateStrict = createStrictHandler(copyDate);\n\n/**\n * Deeply copy the keys and values of the original.\n */\nexport function copyMap<Value extends Map<any, any>>(map: Value, state: State): Value {\n const clone = new state.Constructor() 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 for (const [key, value] of map) {\n clone.set(key, state.copier(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 function copyMapStrict<Value extends Map<any, any>>(map: Value, state: State): Value {\n return copyOwnPropertiesStrict(map, copyMap(map, state), state, Object.getOwnPropertyNames(map), 0);\n}\n\n/**\n * Deeply copy the properties (keys and symbols) and values of the original.\n */\nexport function copyObject<Value extends Record<string, any>>(object: Value, state: State): Value {\n const clone = getCleanClone(state.prototype);\n\n // set in the cache immediately to be able to reuse the object recursively\n state.cache.set(object, clone);\n\n for (const key of Object.keys(object)) {\n if (key === '__proto__') {\n // Native assignment would attempt to use `Object.setPropertyOf` under the hood, when this\n // property has been explicitly set as a standard property. Using `defineProperty` ensures\n // its treatment in the clone is unchanged from the source.\n Object.defineProperty(clone, key, {\n configurable: true,\n enumerable: true,\n value: state.copier(object[key], state),\n writable: true,\n });\n } else {\n clone[key] = state.copier(object[key], state);\n }\n }\n\n for (const symbol of Object.getOwnPropertySymbols(object)) {\n // Only copy enumerable symbols in loose mode, to align with handling of `keys`.\n if (Object.prototype.propertyIsEnumerable.call(object, symbol)) {\n clone[symbol] = state.copier((object as any)[symbol], state);\n }\n }\n\n return clone;\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 function copyObjectStrict<Value extends Record<string, any>>(object: Value, state: State): Value {\n const clone = getCleanClone(state.prototype);\n\n // set in the cache immediately to be able to reuse the object recursively\n state.cache.set(object, clone);\n\n return copyOwnPropertiesStrict(object, clone, state, Object.getOwnPropertyNames(object), 0);\n}\n\n/**\n * Create a new primitive wrapper from the value of the original.\n */\nexport function copyPrimitiveWrapper<\n // Specifically use the object constructor types\n // eslint-disable-next-line @typescript-eslint/no-wrapper-object-types\n Value extends Boolean | Number | String,\n>(primitiveObject: Value, state: State): Value {\n return new state.Constructor(primitiveObject.valueOf());\n}\n\n/**\n * Create a new primitive wrapper from the value of the original, and copy any\n * custom properties.\n */\nexport const copyPrimitiveWrapperStrict = createStrictHandler(copyPrimitiveWrapper);\n\n/**\n * Create a new RegExp based on the value and flags of the original.\n */\nexport function copyRegExp<Value extends RegExp>(regExp: Value, state: State): Value {\n const clone = new state.Constructor(regExp.source, regExp.flags) as Value;\n\n // `lastIndex` is not retained when constructing anew, so manually copy it.\n clone.lastIndex = regExp.lastIndex;\n\n return clone;\n}\n\n/**\n * Copy the original RegExp, as well as any custom properties.\n */\nexport const copyRegExpStrict = createStrictHandler(copyRegExp);\n\n/**\n * Return the original value (an identity function).\n *\n * @note\n * THis is used for objects that cannot be copied, such as WeakMap.\n */\nexport function copySelf<Value>(value: Value, _state: State): Value {\n return value;\n}\n\n/**\n * Deeply copy the values of the original.\n */\nexport function copySet<Value extends Set<any>>(set: Value, state: State): Value {\n const clone = new state.Constructor() 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 for (const value of set) {\n clone.add(state.copier(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 function copySetStrict<Value extends Set<any>>(set: Value, state: State): Value {\n return copyOwnPropertiesStrict(set, copySet(set, state), state, Object.getOwnPropertyNames(set), 0);\n}\n\n/**\n * Copy the original value based on the handler passed, and also copy custom properties.\n *\n * @note\n * The handlers used here have no nested values to copy, so they skip the cache to keep loose\n * copies fast. Custom properties can reference the value itself, so the clone is cached here\n * before they are copied.\n */\nfunction createStrictHandler<Value extends object>(handler: (value: Value, state: State) => Value) {\n return (value: Value, state: State): Value => {\n const clone = handler(value, state);\n\n // set in the cache immediately to be able to reuse the object recursively\n state.cache.set(value, clone);\n\n return copyOwnPropertiesStrict(value, clone, state, Object.getOwnPropertyNames(value), 0);\n };\n}\n\n/**\n * Create a new String wrapper from the value of the original, and copy custom properties.\n */\n// `String` primitive constructor is intentional.\n// eslint-disable-next-line @typescript-eslint/no-wrapper-object-types\nexport function copyStringStrict<Value extends String>(string: Value, state: State): Value {\n const clone = copyPrimitiveWrapper(string, state);\n\n // set in the cache immediately to be able to reuse the object recursively\n state.cache.set(string, clone);\n\n const { length } = string;\n const names = Object.getOwnPropertyNames(string);\n // Custom integer keys beyond the string's length are listed before `length`, so only skip\n // `length` when it directly follows the characters.\n const start = names[length] === 'length' ? length + 1 : length;\n\n return copyOwnPropertiesStrict(string, clone, state, names, start);\n}\n","import {\n copyArrayBuffer,\n copyArrayBufferStrict,\n copyArray,\n copyArrayStrict,\n copyBlob,\n copyBlobStrict,\n copyDataView,\n copyDataViewStrict,\n copyDate,\n copyDateStrict,\n copyMap,\n copyMapStrict,\n copyObject,\n copyObjectStrict,\n copyPrimitiveWrapper,\n copyPrimitiveWrapperStrict,\n copyRegExp,\n copyRegExpStrict,\n copySelf,\n copySet,\n copySetStrict,\n copyStringStrict,\n} from './copier.js';\nimport type { InternalCopier } from './copier.ts';\nimport type { Cache } from './utils.ts';\n\nexport interface CopierMethods {\n array?: InternalCopier<any[]>;\n arrayBuffer?: InternalCopier<ArrayBuffer>;\n asyncGenerator?: InternalCopier<AsyncGenerator>;\n blob?: InternalCopier<Blob>;\n dataView?: InternalCopier<DataView>;\n date?: InternalCopier<Date>;\n error?: InternalCopier<Error>;\n generator?: InternalCopier<Generator>;\n map?: InternalCopier<Map<any, any>>;\n object?: InternalCopier<Record<string, any>>;\n regExp?: InternalCopier<RegExp>;\n set?: InternalCopier<Set<any>>;\n}\n\ninterface Copiers {\n [key: string]: InternalCopier<any> | undefined;\n\n Arguments: InternalCopier<Record<string, any>>;\n Array: InternalCopier<any[]>;\n ArrayBuffer: InternalCopier<ArrayBuffer>;\n AsyncGenerator: InternalCopier<AsyncGenerator>;\n BigInt64Array: InternalCopier<ArrayBuffer>;\n BigUint64Array: InternalCopier<ArrayBuffer>;\n Blob: InternalCopier<Blob>;\n // eslint-disable-next-line @typescript-eslint/no-wrapper-object-types\n Boolean: InternalCopier<Boolean>;\n DataView: InternalCopier<DataView>;\n Date: InternalCopier<Date>;\n Error: InternalCopier<Error>;\n Float32Array: InternalCopier<ArrayBuffer>;\n Float64Array: InternalCopier<ArrayBuffer>;\n Generator: InternalCopier<Generator>;\n Int8Array: InternalCopier<ArrayBuffer>;\n Int16Array: InternalCopier<ArrayBuffer>;\n Int32Array: InternalCopier<ArrayBuffer>;\n Map: InternalCopier<Map<any, any>>;\n // eslint-disable-next-line @typescript-eslint/no-wrapper-object-types\n Number: InternalCopier<Number>;\n Object: InternalCopier<Record<string, any>>;\n Promise: InternalCopier<Promise<any>>;\n RegExp: InternalCopier<RegExp>;\n Set: InternalCopier<Set<any>>;\n SharedArrayBuffer: InternalCopier<SharedArrayBuffer>;\n // eslint-disable-next-line @typescript-eslint/no-wrapper-object-types\n String: InternalCopier<String>;\n WeakMap: InternalCopier<WeakMap<any, any>>;\n WeakSet: InternalCopier<WeakSet<any>>;\n Uint8Array: InternalCopier<ArrayBuffer>;\n Uint8ClampedArray: InternalCopier<ArrayBuffer>;\n Uint16Array: InternalCopier<ArrayBuffer>;\n Uint32Array: InternalCopier<ArrayBuffer>;\n}\n\nexport interface CreateCopierOptions {\n /**\n * Creates the cache used to track values already copied, which is what allows circular\n * references to resolve to their clone instead of recursing infinitely. A new cache is\n * created for each top-level copy. Since it only needs to satisfy the `has` / `get` /\n * `set` contract, a bounded implementation such as an LRU cache can be used to trade\n * circular reference handling for a smaller memory footprint.\n *\n * @default () => new WeakMap()\n */\n createCache?: () => Cache;\n /**\n * The maximum number of nested objects to traverse before throwing a\n * `MaxDepthExceededError`. Pass `Infinity` to traverse without a limit.\n *\n * @default 1000\n */\n maxDepth?: number;\n /**\n * Overrides of the copiers used for specific object types, allowing custom copy\n * semantics for those types. Any type not overridden uses its default copier. Each\n * method receives the value to copy and the current `State`, and is responsible for\n * populating `state.cache` and recursing via `state.copier` if it wants circular\n * reference handling and deep copies respectively.\n */\n methods?: CopierMethods;\n /**\n * Copies all own properties with their original property descriptors, including\n * non-enumerable properties, symbols, and non-index properties on arrays.\n *\n * @note\n * This is significantly slower than the default \"loose\" copy, so it should only be used\n * when the exact shape of the original must be replicated.\n *\n * @default false\n */\n strict?: boolean;\n}\n\nexport interface RequiredCreateCopierOptions extends Omit<Required<CreateCopierOptions>, 'methods'> {\n copiers: Copiers;\n methods: Required<CopierMethods>;\n}\n\n/**\n * The maximum depth traversed when none is provided.\n *\n * @note\n * This is deliberately below the depth at which the native call stack is exhausted\n * (~1875 for strict copies in node), so that untrusted, deeply-nested values fail with a\n * catchable, descriptive error instead of a raw `RangeError`.\n */\nexport const DEFAULT_MAX_DEPTH = 1000;\n\nexport function createDefaultCache(): Cache {\n return new WeakMap();\n}\n\nexport function getOptions({\n createCache: createCacheOverride,\n maxDepth,\n methods: methodsOverride,\n strict,\n}: CreateCopierOptions): RequiredCreateCopierOptions {\n const defaultMethods = {\n array: strict ? copyArrayStrict : copyArray,\n arrayBuffer: strict ? copyArrayBufferStrict : copyArrayBuffer,\n asyncGenerator: copySelf,\n blob: strict ? copyBlobStrict : copyBlob,\n dataView: strict ? copyDataViewStrict : copyDataView,\n date: strict ? copyDateStrict : copyDate,\n error: copySelf,\n generator: copySelf,\n map: strict ? copyMapStrict : copyMap,\n object: strict ? copyObjectStrict : copyObject,\n regExp: strict ? copyRegExpStrict : copyRegExp,\n set: strict ? copySetStrict : copySet,\n };\n\n const methods = methodsOverride ? Object.assign(defaultMethods, methodsOverride) : defaultMethods;\n const copiers = getTagSpecificCopiers(methods, strict);\n const createCache = createCacheOverride || createDefaultCache;\n\n // Extra safety check to ensure that object and array copiers are always provided,\n // avoiding runtime errors.\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n if (!copiers.Object || !copiers.Array) {\n throw new Error('An object and array copier must be provided.');\n }\n\n return {\n createCache,\n copiers,\n maxDepth: maxDepth == null ? DEFAULT_MAX_DEPTH : maxDepth,\n methods,\n strict: Boolean(strict),\n };\n}\n\n/**\n * Get the copiers used for each specific object tag.\n */\nexport function getTagSpecificCopiers(methods: Required<CopierMethods>, strict: boolean | undefined): Copiers {\n const copyPrimitive = strict ? copyPrimitiveWrapperStrict : copyPrimitiveWrapper;\n\n // A `null` prototype is used so that a value carrying a custom `Symbol.toStringTag`\n // cannot resolve to an inherited `Object.prototype` member as its copier. Without it,\n // a tag such as `toString` or `valueOf` finds a function on the prototype chain and\n // that function is invoked in place of a real copier.\n return Object.assign(Object.create(null) as Copiers, {\n Arguments: methods.object,\n Array: methods.array,\n ArrayBuffer: methods.arrayBuffer,\n AsyncGenerator: methods.asyncGenerator,\n BigInt64Array: methods.arrayBuffer,\n BigUint64Array: methods.arrayBuffer,\n Blob: methods.blob,\n Boolean: copyPrimitive,\n DataView: methods.dataView,\n Date: methods.date,\n Error: methods.error,\n Float32Array: methods.arrayBuffer,\n Float64Array: methods.arrayBuffer,\n Generator: methods.generator,\n Int8Array: methods.arrayBuffer,\n Int16Array: methods.arrayBuffer,\n Int32Array: methods.arrayBuffer,\n Map: methods.map,\n Number: copyPrimitive,\n Object: methods.object,\n Promise: copySelf,\n RegExp: methods.regExp,\n Set: methods.set,\n SharedArrayBuffer: methods.arrayBuffer,\n String: strict ? copyStringStrict : copyPrimitiveWrapper,\n WeakMap: copySelf,\n WeakSet: copySelf,\n Uint8Array: methods.arrayBuffer,\n Uint8ClampedArray: methods.arrayBuffer,\n Uint16Array: methods.arrayBuffer,\n Uint32Array: methods.arrayBuffer,\n });\n}\n","import type { State } from './copier.ts';\nimport { getOptions } from './options.js';\nimport type { CreateCopierOptions } from './options.ts';\nimport { getTag, MaxDepthExceededError } from './utils.js';\n\nexport type { State } from './copier.ts';\nexport type { CreateCopierOptions } from './options.ts';\nexport { MaxDepthExceededError } from './utils.js';\n\n/**\n * Create a custom copier based on custom options for any of the following:\n * - `createCache` method to create a cache for copied objects\n * - custom copier `methods` for specific object types\n * - `strict` mode to copy all properties with their descriptors\n */\nexport function createCopier(options: CreateCopierOptions = {}) {\n const { createCache, copiers, maxDepth } = getOptions(options);\n const { Array: copyArray, Object: copyObject } = copiers;\n\n function copier(value: any, state: State): any {\n state.prototype = state.Constructor = undefined;\n\n if (!value || typeof value !== 'object') {\n return value;\n }\n\n if (state.cache.has(value)) {\n return state.cache.get(value);\n }\n\n // Bound the traversal of nested objects, so that values nested more deeply than the\n // call stack can handle fail with a descriptive error instead of a raw `RangeError`.\n if (++state.depth > maxDepth) {\n throw new MaxDepthExceededError(maxDepth);\n }\n\n state.prototype = Object.getPrototypeOf(value);\n // Using logical AND for speed, since optional chaining transforms to\n // a local variable usage.\n // eslint-disable-next-line @typescript-eslint/prefer-optional-chain\n state.Constructor = state.prototype && state.prototype.constructor;\n\n let clone: any;\n\n // plain objects\n if (!state.Constructor || state.Constructor === Object) {\n clone = copyObject(value as Record<string, any>, state);\n } else if (Array.isArray(value)) {\n // arrays\n clone = copyArray(value, state);\n } else {\n const tagSpecificCopier = copiers[getTag(value)];\n\n if (tagSpecificCopier) {\n clone = tagSpecificCopier(value, state);\n } else {\n clone = typeof value.then === 'function' ? value : copyObject(value as Record<string, any>, state);\n }\n }\n\n --state.depth;\n\n return clone;\n }\n\n return function copy<Value>(value: Value): Value {\n return copier(value, {\n Constructor: undefined,\n cache: createCache(),\n copier,\n depth: 0,\n prototype: undefined,\n });\n };\n}\n\n/**\n * Copy an value deeply as much as possible, where strict recreation of object properties\n * are maintained. All properties (including non-enumerable ones) are copied with their\n * original property descriptors on both objects and arrays.\n */\nexport const copyStrict = createCopier({ strict: true });\n\n/**\n * Copy an value deeply as much as possible.\n */\nexport const copy = createCopier();\n"],"names":[],"m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;IACJ,IAAA,CAAC;IACH;IAEA;;;;IAIG;AACI,UAAM,UAAU,GAAG,YAAY,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE;IAEvD;;IAEG;AACI,UAAM,IAAI,GAAG,YAAY;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/utils.ts","../../../src/copier.ts","../../../src/options.ts","../../../src/index.ts"],"sourcesContent":["export interface Cache {\n has: (value: any) => boolean;\n set: (key: any, value: any) => void;\n get: (key: any) => any;\n}\n\n/**\n * Error thrown when the copier traverses deeper than the configured `maxDepth`.\n *\n * @note\n * Extends `RangeError` for backwards compatibility, since exceeding the maximum depth\n * previously surfaced as a native `RangeError` from stack exhaustion.\n */\nexport class MaxDepthExceededError extends RangeError {\n readonly maxDepth: number;\n\n constructor(maxDepth: number) {\n super(`Maximum copy depth of ${String(maxDepth)} exceeded; the value copied is nested too deeply.`);\n\n this.maxDepth = maxDepth;\n this.name = 'MaxDepthExceededError';\n }\n}\n\n// eslint-disable-next-line @typescript-eslint/unbound-method\nconst toStringFunction = Function.prototype.toString;\n// eslint-disable-next-line @typescript-eslint/unbound-method\nconst toStringObject = Object.prototype.toString;\n\n/**\n * Get an empty version of the object with the same prototype it has.\n */\nexport function getCleanClone(prototype: any): any {\n if (!prototype) {\n return Object.create(null);\n }\n\n const Constructor = prototype.constructor;\n\n if (Constructor === Object) {\n return prototype === Object.prototype ? {} : Object.create(prototype as object | null);\n }\n\n // 2026-10-10: Prototype constructor properties may contain ordinary data.\n if (typeof Constructor === 'function' && ~toStringFunction.call(Constructor).indexOf('[native code]')) {\n try {\n return new Constructor();\n } catch {\n // Ignore\n }\n }\n\n return Object.create(prototype as object | null);\n}\n\n/**\n * Get the tag of the value passed, so that the correct copier can be used.\n */\nexport function getTag(value: any): string {\n const stringTag = value[Symbol.toStringTag];\n\n if (stringTag) {\n return stringTag;\n }\n\n const type = toStringObject.call(value);\n\n return type.substring(8, type.length - 1);\n}\n","import { getCleanClone, getTag } from './utils.js';\nimport type { Cache } from './utils.ts';\n\nexport type InternalCopier<Value> = (value: Value, state: State) => Value;\n\nexport interface State {\n /**\n * The constructor of the value currently being copied, derived from its `prototype`.\n * Used to construct the clone for values that are not plain objects, such as subclasses\n * of `Array` or custom classes.\n *\n * @note\n * This is `undefined` for primitives and for values already present in the `cache`. It is\n * also reassigned for every value copied, so it must be read before any recursive\n * `copier` call is made, not after.\n */\n Constructor: any;\n /**\n * The cache of values already copied, mapping each original to its clone. Copiers should\n * populate it with the clone _before_ copying that value's contents, so that circular\n * references resolve to the clone rather than recursing infinitely.\n */\n cache: Cache;\n /**\n * The copier used for nested values. Call it as `state.copier(value, state)` to deeply\n * copy the contents of the value being copied.\n */\n copier: InternalCopier<any>;\n /**\n * The number of nested objects currently being copied, used to bound traversal of\n * deeply-nested values before the call stack is exhausted.\n *\n * @note\n * This is maintained by the copier itself; custom methods should not modify it.\n */\n depth: number;\n /**\n * The prototype of the value currently being copied, used to create a clone that\n * maintains the original's prototype chain.\n *\n * @note\n * This is `undefined` for primitives and for values already present in the `cache`. It is\n * also reassigned for every value copied, so it must be read before any recursive\n * `copier` call is made, not after.\n */\n prototype: any;\n}\n\n/**\n * The shared `%TypedArray%.prototype.slice`, which every typed array inherits.\n *\n * @note\n * This is used instead of the `slice` found on the value itself because subclasses can\n * override it with one that does not copy. `Buffer` is the notable case: its `slice`\n * returns a view over the same memory, so copying through it would alias the original.\n */\nconst sliceTypedArray = Object.getPrototypeOf(Int8Array.prototype).slice as (\n this: ArrayBufferView,\n start: number,\n) => ArrayBufferView;\n\n/**\n * Copy the descriptor from the original value to the clone.\n */\nfunction copyOwnDescriptor<Value extends object>(\n original: Value,\n clone: Value,\n property: string | symbol,\n state: State,\n): void {\n const ownDescriptor = Object.getOwnPropertyDescriptor(original, property) || {\n configurable: true,\n enumerable: true,\n value: original[property as keyof Value],\n writable: true,\n };\n const descriptor =\n ownDescriptor.get || ownDescriptor.set\n ? ownDescriptor\n : {\n configurable: ownDescriptor.configurable,\n enumerable: ownDescriptor.enumerable,\n value: state.copier(ownDescriptor.value, state),\n writable: ownDescriptor.writable,\n };\n\n try {\n Object.defineProperty(clone, property, descriptor);\n } catch {\n // The above can fail on node in extreme edge cases, so fall back to the loose assignment.\n clone[property as keyof Value] = descriptor.get ? descriptor.get() : descriptor.value;\n }\n}\n\n/**\n * Define the value as a standard (configurable, enumerable, writable) own property of the clone.\n */\nfunction defineOwnValue(clone: object, property: string | symbol, value: unknown): void {\n Object.defineProperty(clone, property, {\n configurable: true,\n enumerable: true,\n value,\n writable: true,\n });\n}\n\n/**\n * Strictly copy all properties contained on the object, starting with the name at the `start` index.\n *\n * @note\n * `Object.getOwnPropertyNames` lists integer keys first in ascending order, so array-like values\n * whose indices are already copied can pass their count as `start` to skip them.\n */\nfunction copyOwnPropertiesStrict<Value extends object>(\n value: Value,\n clone: Value,\n state: State,\n names: string[],\n start: number,\n): Value {\n for (let index = start; index < names.length; ++index) {\n copyOwnDescriptor(value, clone, names[index]!, state);\n }\n\n for (const symbol of Object.getOwnPropertySymbols(value)) {\n copyOwnDescriptor(value, clone, symbol, state);\n }\n\n return clone;\n}\n\n/**\n * Deeply copy the indexed values in the array.\n */\nexport function copyArray<Value extends any[]>(array: Value, state: State): Value {\n const clone = new state.Constructor();\n\n // set in the cache immediately to be able to reuse the object recursively\n state.cache.set(array, clone);\n\n for (let index = 0; index < array.length; ++index) {\n clone[index] = state.copier(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 function copyArrayStrict<Value extends any[]>(array: Value, state: State): Value {\n const clone = new state.Constructor() 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 // Indices are copied by descriptor rather than by assignment, unlike typed arrays and strings,\n // because array indices can be holes, accessors, or non-writable / non-enumerable values.\n return copyOwnPropertiesStrict(array, clone, state, Object.getOwnPropertyNames(array), 0);\n}\n\n/**\n * Copy the contents of the ArrayBuffer, or of the typed array viewing one.\n *\n * @note\n * `slice` always returns a fixed-length buffer, so a resizable or growable buffer that can change\n * size is instead constructed with the same `maxByteLength` and has its contents copied in.\n */\nexport function copyArrayBuffer<Value extends ArrayBufferLike | ArrayBufferView>(\n arrayBuffer: Value,\n state: State,\n): Value {\n if (ArrayBuffer.isView(arrayBuffer)) {\n return sliceTypedArray.call(arrayBuffer, 0) as Value;\n }\n\n if ((arrayBuffer as ArrayBuffer).resizable || (arrayBuffer as SharedArrayBuffer).growable) {\n const maxByteLength = (arrayBuffer as ArrayBuffer).maxByteLength;\n const clone = new state.Constructor(arrayBuffer.byteLength, { maxByteLength });\n\n // The new buffer is zero-filled, and buffers can only be read or written through a view, so\n // copy the original's bytes into it through byte-level views of both. Without this, the clone\n // would have the right size but be all zeros.\n new Uint8Array(clone).set(new Uint8Array(arrayBuffer));\n\n return clone as Value;\n }\n\n // V8 throws when slicing an empty, fixed-length SharedArrayBuffer.\n if (!arrayBuffer.byteLength && getTag(arrayBuffer) === 'SharedArrayBuffer') {\n return new state.Constructor(0) as Value;\n }\n\n return arrayBuffer.slice(0) as Value;\n}\n\n/**\n * Copy the contents of the ArrayBuffer, or of the typed array viewing one, as well as\n * any custom properties.\n */\nexport function copyArrayBufferStrict<Value extends ArrayBufferLike | ArrayBufferView>(\n arrayBuffer: Value,\n state: State,\n): Value {\n const clone = copyArrayBuffer(arrayBuffer, state);\n\n // set in the cache immediately to be able to reuse the object recursively\n state.cache.set(arrayBuffer, clone);\n\n // Typed arrays list their indices first, but unlike arrays have no own `length` to skip. The\n // fresh clone is read, since the original may have an own `length` that shadows the real one.\n const start = ArrayBuffer.isView(clone) ? (clone as unknown as ArrayLike<unknown>).length || 0 : 0;\n\n return copyOwnPropertiesStrict(arrayBuffer, clone, state, Object.getOwnPropertyNames(arrayBuffer), start);\n}\n\n/**\n * Create a new Blob with the contents of the original.\n */\nexport function copyBlob<Value extends Blob>(blob: Value, _state: State): Value {\n return blob.slice(0, blob.size, blob.type) as Value;\n}\n\n/**\n * Create a new Blob with the contents of the original, and copy any custom properties.\n */\nexport const copyBlobStrict = createStrictHandler(copyBlob);\n\n/**\n * Create a new DataView with the contents of the original.\n */\nexport function copyDataView<Value extends DataView>(dataView: Value, state: State): Value {\n return new state.Constructor(state.copier(dataView.buffer, state), dataView.byteOffset, dataView.byteLength);\n}\n\n/**\n * Create a new DataView with the contents of the original, and copy any custom properties.\n *\n * @note\n * The buffer is shared with any other reference to it in the value being copied, and has\n * its own custom properties copied, the same as if it were reached directly.\n */\nexport function copyDataViewStrict<Value extends DataView>(dataView: Value, state: State): Value {\n const { buffer } = dataView;\n const { cache, Constructor } = state;\n const bufferCopied = cache.has(buffer);\n const bufferClone = bufferCopied ? cache.get(buffer) : state.copier(buffer, state);\n\n // The buffer's custom properties may reference this DataView, in which case copying the buffer\n // already created and cached its clone. Reuse it so that every reference resolves to one clone.\n if (!bufferCopied && cache.has(dataView)) {\n return cache.get(dataView);\n }\n\n const clone = new Constructor(bufferClone, dataView.byteOffset, dataView.byteLength) as Value;\n\n // set in the cache immediately to be able to reuse the object recursively.\n state.cache.set(dataView, clone);\n\n return copyOwnPropertiesStrict(dataView, clone, state, Object.getOwnPropertyNames(dataView), 0);\n}\n\n/**\n * Create a new Date based on the time of the original.\n */\nexport function copyDate<Value extends Date>(date: Value, state: State): Value {\n return new state.Constructor(date.getTime());\n}\n\n/**\n * Create a new Date based on the time of the original, and copy any custom properties.\n */\nexport const copyDateStrict = createStrictHandler(copyDate);\n\n/**\n * Deeply copy the keys and values of the original.\n */\nexport function copyMap<Value extends Map<any, any>>(map: Value, state: State): Value {\n const clone = new state.Constructor() 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 for (const [key, value] of map) {\n clone.set(key, state.copier(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 function copyMapStrict<Value extends Map<any, any>>(map: Value, state: State): Value {\n return copyOwnPropertiesStrict(map, copyMap(map, state), state, Object.getOwnPropertyNames(map), 0);\n}\n\n/**\n * Deeply copy the properties (keys and symbols) and values of the original.\n *\n * @note\n * Values are assigned for performance, but assignment respects the prototype chain, so it throws\n * when the key shadows an inherited read-only or getter-only property. In that case the value is\n * defined directly, still producing the standard own property expected in loose mode. This relies\n * on the source running in strict mode, where a failed assignment throws instead of being silently\n * ignored.\n */\nexport function copyObject<Value extends Record<string, any>>(object: Value, state: State): Value {\n const clone: Record<string | symbol, unknown> = getCleanClone(state.prototype);\n\n // set in the cache immediately to be able to reuse the object recursively\n state.cache.set(object, clone);\n\n for (const key of Object.keys(object)) {\n const value = state.copier(object[key], state);\n\n if (key === '__proto__') {\n // Native assignment would attempt to use `Object.setPropertyOf` under the hood, when this\n // property has been explicitly set as a standard property. Using `defineProperty` ensures\n // its treatment in the clone is unchanged from the source.\n defineOwnValue(clone, key, value);\n } else {\n try {\n clone[key] = value;\n } catch {\n defineOwnValue(clone, key, value);\n }\n }\n }\n\n for (const symbol of Object.getOwnPropertySymbols(object)) {\n // Only copy enumerable symbols in loose mode, to align with handling of `keys`.\n if (Object.prototype.propertyIsEnumerable.call(object, symbol)) {\n const value = state.copier((object as any)[symbol], state);\n\n try {\n clone[symbol] = value;\n } catch {\n defineOwnValue(clone, symbol, value);\n }\n }\n }\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 function copyObjectStrict<Value extends Record<string, any>>(object: Value, state: State): Value {\n const clone = getCleanClone(state.prototype);\n\n // set in the cache immediately to be able to reuse the object recursively\n state.cache.set(object, clone);\n\n return copyOwnPropertiesStrict(object, clone, state, Object.getOwnPropertyNames(object), 0);\n}\n\n/**\n * Create a new primitive wrapper from the value of the original.\n */\nexport function copyPrimitiveWrapper<\n // Specifically use the object constructor types\n // eslint-disable-next-line @typescript-eslint/no-wrapper-object-types\n Value extends Boolean | Number | String,\n>(primitiveObject: Value, state: State): Value {\n return new state.Constructor(primitiveObject.valueOf());\n}\n\n/**\n * Create a new primitive wrapper from the value of the original, and copy any\n * custom properties.\n */\nexport const copyPrimitiveWrapperStrict = createStrictHandler(copyPrimitiveWrapper);\n\n/**\n * Create a new RegExp based on the value and flags of the original.\n */\nexport function copyRegExp<Value extends RegExp>(regExp: Value, state: State): Value {\n const clone = new state.Constructor(regExp.source, regExp.flags) as Value;\n\n // `lastIndex` is not retained when constructing anew, so manually copy it.\n clone.lastIndex = regExp.lastIndex;\n\n return clone;\n}\n\n/**\n * Copy the original RegExp, as well as any custom properties.\n */\nexport const copyRegExpStrict = createStrictHandler(copyRegExp);\n\n/**\n * Return the original value (an identity function).\n *\n * @note\n * THis is used for objects that cannot be copied, such as WeakMap.\n */\nexport function copySelf<Value>(value: Value, _state: State): Value {\n return value;\n}\n\n/**\n * Deeply copy the values of the original.\n */\nexport function copySet<Value extends Set<any>>(set: Value, state: State): Value {\n const clone = new state.Constructor() 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 for (const value of set) {\n clone.add(state.copier(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 function copySetStrict<Value extends Set<any>>(set: Value, state: State): Value {\n return copyOwnPropertiesStrict(set, copySet(set, state), state, Object.getOwnPropertyNames(set), 0);\n}\n\n/**\n * Copy the original value based on the handler passed, and also copy custom properties.\n *\n * @note\n * The handlers used here have no nested values to copy, so they skip the cache to keep loose\n * copies fast. Custom properties can reference the value itself, so the clone is cached here\n * before they are copied.\n */\nfunction createStrictHandler<Value extends object>(handler: (value: Value, state: State) => Value) {\n return (value: Value, state: State): Value => {\n const clone = handler(value, state);\n\n // set in the cache immediately to be able to reuse the object recursively\n state.cache.set(value, clone);\n\n return copyOwnPropertiesStrict(value, clone, state, Object.getOwnPropertyNames(value), 0);\n };\n}\n\n/**\n * Create a new String wrapper from the value of the original, and copy custom properties.\n */\n// `String` primitive constructor is intentional.\n// eslint-disable-next-line @typescript-eslint/no-wrapper-object-types\nexport function copyStringStrict<Value extends String>(string: Value, state: State): Value {\n const clone = copyPrimitiveWrapper(string, state);\n\n // set in the cache immediately to be able to reuse the object recursively\n state.cache.set(string, clone);\n\n const { length } = string;\n const names = Object.getOwnPropertyNames(string);\n // Custom integer keys beyond the string's length are listed before `length`, so only skip\n // `length` when it directly follows the characters.\n const start = names[length] === 'length' ? length + 1 : length;\n\n return copyOwnPropertiesStrict(string, clone, state, names, start);\n}\n","import {\n copyArrayBuffer,\n copyArrayBufferStrict,\n copyArray,\n copyArrayStrict,\n copyBlob,\n copyBlobStrict,\n copyDataView,\n copyDataViewStrict,\n copyDate,\n copyDateStrict,\n copyMap,\n copyMapStrict,\n copyObject,\n copyObjectStrict,\n copyPrimitiveWrapper,\n copyPrimitiveWrapperStrict,\n copyRegExp,\n copyRegExpStrict,\n copySelf,\n copySet,\n copySetStrict,\n copyStringStrict,\n} from './copier.js';\nimport type { InternalCopier } from './copier.ts';\nimport type { Cache } from './utils.ts';\n\nexport interface CopierMethods {\n array?: InternalCopier<any[]>;\n arrayBuffer?: InternalCopier<ArrayBuffer>;\n asyncGenerator?: InternalCopier<AsyncGenerator>;\n blob?: InternalCopier<Blob>;\n dataView?: InternalCopier<DataView>;\n date?: InternalCopier<Date>;\n error?: InternalCopier<Error>;\n generator?: InternalCopier<Generator>;\n map?: InternalCopier<Map<any, any>>;\n object?: InternalCopier<Record<string, any>>;\n regExp?: InternalCopier<RegExp>;\n set?: InternalCopier<Set<any>>;\n}\n\ninterface Copiers {\n [key: string]: InternalCopier<any> | undefined;\n\n Arguments: InternalCopier<Record<string, any>>;\n Array: InternalCopier<any[]>;\n ArrayBuffer: InternalCopier<ArrayBuffer>;\n AsyncGenerator: InternalCopier<AsyncGenerator>;\n BigInt64Array: InternalCopier<ArrayBuffer>;\n BigUint64Array: InternalCopier<ArrayBuffer>;\n Blob: InternalCopier<Blob>;\n // eslint-disable-next-line @typescript-eslint/no-wrapper-object-types\n Boolean: InternalCopier<Boolean>;\n DataView: InternalCopier<DataView>;\n Date: InternalCopier<Date>;\n Error: InternalCopier<Error>;\n Float32Array: InternalCopier<ArrayBuffer>;\n Float64Array: InternalCopier<ArrayBuffer>;\n Generator: InternalCopier<Generator>;\n Int8Array: InternalCopier<ArrayBuffer>;\n Int16Array: InternalCopier<ArrayBuffer>;\n Int32Array: InternalCopier<ArrayBuffer>;\n Map: InternalCopier<Map<any, any>>;\n // eslint-disable-next-line @typescript-eslint/no-wrapper-object-types\n Number: InternalCopier<Number>;\n Object: InternalCopier<Record<string, any>>;\n Promise: InternalCopier<Promise<any>>;\n RegExp: InternalCopier<RegExp>;\n Set: InternalCopier<Set<any>>;\n SharedArrayBuffer: InternalCopier<SharedArrayBuffer>;\n // eslint-disable-next-line @typescript-eslint/no-wrapper-object-types\n String: InternalCopier<String>;\n WeakMap: InternalCopier<WeakMap<any, any>>;\n WeakSet: InternalCopier<WeakSet<any>>;\n Uint8Array: InternalCopier<ArrayBuffer>;\n Uint8ClampedArray: InternalCopier<ArrayBuffer>;\n Uint16Array: InternalCopier<ArrayBuffer>;\n Uint32Array: InternalCopier<ArrayBuffer>;\n}\n\nexport interface CreateCopierOptions {\n /**\n * Creates the cache used to track values already copied, which is what allows circular\n * references to resolve to their clone instead of recursing infinitely. A new cache is\n * created for each top-level copy. Since it only needs to satisfy the `has` / `get` /\n * `set` contract, a bounded implementation such as an LRU cache can be used to trade\n * circular reference handling for a smaller memory footprint.\n *\n * @default () => new WeakMap()\n */\n createCache?: () => Cache;\n /**\n * The maximum number of nested objects to traverse before throwing a\n * `MaxDepthExceededError`. Pass `Infinity` to traverse without a limit.\n *\n * @default 1000\n */\n maxDepth?: number;\n /**\n * Overrides of the copiers used for specific object types, allowing custom copy\n * semantics for those types. Any type not overridden uses its default copier. Each\n * method receives the value to copy and the current `State`, and is responsible for\n * populating `state.cache` and recursing via `state.copier` if it wants circular\n * reference handling and deep copies respectively.\n */\n methods?: CopierMethods;\n /**\n * Copies all own properties with their original property descriptors, including\n * non-enumerable properties, symbols, and non-index properties on arrays.\n *\n * @note\n * This is significantly slower than the default \"loose\" copy, so it should only be used\n * when the exact shape of the original must be replicated.\n *\n * @default false\n */\n strict?: boolean;\n}\n\nexport interface RequiredCreateCopierOptions extends Omit<Required<CreateCopierOptions>, 'methods'> {\n copiers: Copiers;\n methods: Required<CopierMethods>;\n}\n\n/**\n * The maximum depth traversed when none is provided.\n *\n * @note\n * This is deliberately below the depth at which the native call stack is exhausted\n * (~1875 for strict copies in node), so that untrusted, deeply-nested values fail with a\n * catchable, descriptive error instead of a raw `RangeError`.\n */\nexport const DEFAULT_MAX_DEPTH = 1000;\n\nexport function createDefaultCache(): Cache {\n return new WeakMap();\n}\n\nexport function getOptions({\n createCache: createCacheOverride,\n maxDepth,\n methods: methodsOverride,\n strict,\n}: CreateCopierOptions): RequiredCreateCopierOptions {\n const defaultMethods = {\n array: strict ? copyArrayStrict : copyArray,\n arrayBuffer: strict ? copyArrayBufferStrict : copyArrayBuffer,\n asyncGenerator: copySelf,\n blob: strict ? copyBlobStrict : copyBlob,\n dataView: strict ? copyDataViewStrict : copyDataView,\n date: strict ? copyDateStrict : copyDate,\n error: copySelf,\n generator: copySelf,\n map: strict ? copyMapStrict : copyMap,\n object: strict ? copyObjectStrict : copyObject,\n regExp: strict ? copyRegExpStrict : copyRegExp,\n set: strict ? copySetStrict : copySet,\n };\n\n const methods = methodsOverride ? Object.assign(defaultMethods, methodsOverride) : defaultMethods;\n const copiers = getTagSpecificCopiers(methods, strict);\n const createCache = createCacheOverride || createDefaultCache;\n\n // Extra safety check to ensure that object and array copiers are always provided,\n // avoiding runtime errors.\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n if (!copiers.Object || !copiers.Array) {\n throw new Error('An object and array copier must be provided.');\n }\n\n return {\n createCache,\n copiers,\n maxDepth: maxDepth == null ? DEFAULT_MAX_DEPTH : maxDepth,\n methods,\n strict: Boolean(strict),\n };\n}\n\n/**\n * Get the copiers used for each specific object tag.\n */\nexport function getTagSpecificCopiers(methods: Required<CopierMethods>, strict: boolean | undefined): Copiers {\n const copyPrimitive = strict ? copyPrimitiveWrapperStrict : copyPrimitiveWrapper;\n\n // A `null` prototype is used so that a value carrying a custom `Symbol.toStringTag`\n // cannot resolve to an inherited `Object.prototype` member as its copier. Without it,\n // a tag such as `toString` or `valueOf` finds a function on the prototype chain and\n // that function is invoked in place of a real copier.\n return Object.assign(Object.create(null) as Copiers, {\n Arguments: methods.object,\n Array: methods.array,\n ArrayBuffer: methods.arrayBuffer,\n AsyncGenerator: methods.asyncGenerator,\n BigInt64Array: methods.arrayBuffer,\n BigUint64Array: methods.arrayBuffer,\n Blob: methods.blob,\n Boolean: copyPrimitive,\n DataView: methods.dataView,\n Date: methods.date,\n Error: methods.error,\n Float32Array: methods.arrayBuffer,\n Float64Array: methods.arrayBuffer,\n Generator: methods.generator,\n Int8Array: methods.arrayBuffer,\n Int16Array: methods.arrayBuffer,\n Int32Array: methods.arrayBuffer,\n Map: methods.map,\n Number: copyPrimitive,\n Object: methods.object,\n Promise: copySelf,\n RegExp: methods.regExp,\n Set: methods.set,\n SharedArrayBuffer: methods.arrayBuffer,\n String: strict ? copyStringStrict : copyPrimitiveWrapper,\n WeakMap: copySelf,\n WeakSet: copySelf,\n Uint8Array: methods.arrayBuffer,\n Uint8ClampedArray: methods.arrayBuffer,\n Uint16Array: methods.arrayBuffer,\n Uint32Array: methods.arrayBuffer,\n });\n}\n","import type { State } from './copier.ts';\nimport { getOptions } from './options.js';\nimport type { CreateCopierOptions } from './options.ts';\nimport { getTag, MaxDepthExceededError } from './utils.js';\n\nexport type { State } from './copier.ts';\nexport type { CreateCopierOptions } from './options.ts';\nexport { MaxDepthExceededError } from './utils.js';\n\n/**\n * Create a custom copier based on custom options for any of the following:\n * - `createCache` method to create a cache for copied objects\n * - custom copier `methods` for specific object types\n * - `strict` mode to copy all properties with their descriptors\n */\nexport function createCopier(options: CreateCopierOptions = {}) {\n const { createCache, copiers, maxDepth } = getOptions(options);\n const { Array: copyArray, Object: copyObject } = copiers;\n\n function copier(value: any, state: State): any {\n state.prototype = state.Constructor = undefined;\n\n if (!value || typeof value !== 'object') {\n return value;\n }\n\n if (state.cache.has(value)) {\n return state.cache.get(value);\n }\n\n // Bound the traversal of nested objects, so that values nested more deeply than the\n // call stack can handle fail with a descriptive error instead of a raw `RangeError`.\n if (++state.depth > maxDepth) {\n throw new MaxDepthExceededError(maxDepth);\n }\n\n state.prototype = Object.getPrototypeOf(value);\n // Using logical AND for speed, since optional chaining transforms to\n // a local variable usage.\n // eslint-disable-next-line @typescript-eslint/prefer-optional-chain\n state.Constructor = state.prototype && state.prototype.constructor;\n\n let clone: any;\n\n // plain objects\n if (!state.Constructor || state.Constructor === Object) {\n clone = copyObject(value as Record<string, any>, state);\n } else if (Array.isArray(value)) {\n // arrays\n clone = copyArray(value, state);\n } else {\n const tagSpecificCopier = copiers[getTag(value)];\n\n if (tagSpecificCopier) {\n clone = tagSpecificCopier(value, state);\n } else {\n clone = typeof value.then === 'function' ? value : copyObject(value as Record<string, any>, state);\n }\n }\n\n --state.depth;\n\n return clone;\n }\n\n return function copy<Value>(value: Value): Value {\n return copier(value, {\n Constructor: undefined,\n cache: createCache(),\n copier,\n depth: 0,\n prototype: undefined,\n });\n };\n}\n\n/**\n * Copy an value deeply as much as possible, where strict recreation of object properties\n * are maintained. All properties (including non-enumerable ones) are copied with their\n * original property descriptors on both objects and arrays.\n */\nexport const copyStrict = createCopier({ strict: true });\n\n/**\n * Copy an value deeply as much as possible.\n */\nexport const copy = createCopier();\n"],"names":[],"mappings":";;;;;;IAMA;;;;;;IAMG;IACG,MAAO,qBAAsB,SAAQ,UAAU,CAAA;IAGnD,IAAA,WAAA,CAAY,QAAgB,EAAA;YAC1B,KAAK,CAAC,yBAAyB,MAAM,CAAC,QAAQ,CAAC,CAAA,iDAAA,CAAmD,CAAC;IAEnG,QAAA,IAAI,CAAC,QAAQ,GAAG,QAAQ;IACxB,QAAA,I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YAAA,WAAW,EAAE,SAAS;gBACtB,KAAK,EAAE,WAAW,EAAE;gBACpB,MAAM;IACN,YAAA,KAAK,EAAE,CAAC;IACR,YAAA,SAAS,EAAE,SAAS;IACrB,SAAA,CAAC;IACJ,IAAA,CAAC;IACH;IAEA;;;;IAIG;AACI,UAAM,UAAU,GAAG,YAAY,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE;IAEvD;;IAEG;AACI,UAAM,IAAI,GAAG,YAAY;;;;;;;"}
|
|
@@ -5,6 +5,37 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [v1.14.0](https://github.com/inspect-js/object-inspect/compare/v1.13.4...v1.14.0) - 2026-11-18
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
|
|
12
|
+
- [New] add `breakLength` option [`#47`](https://github.com/inspect-js/object-inspect/issues/47)
|
|
13
|
+
- [New] add `maxCollectionLength` option [`#44`](https://github.com/inspect-js/object-inspect/issues/44) [`#51`](https://github.com/inspect-js/object-inspect/issues/51)
|
|
14
|
+
|
|
15
|
+
### Commits
|
|
16
|
+
|
|
17
|
+
- [New] `breakLength`: measure array entries by display width, like `util.inspect` [`77a3946`](https://github.com/inspect-js/object-inspect/commit/77a394674a5ef46830c93869af28da57f6793263)
|
|
18
|
+
- [meta] add `generate:string-width` script, to regenerate the display width table [`6aabdb7`](https://github.com/inspect-js/object-inspect/commit/6aabdb75a5c5a908bcc371abdff52ccb392f647b)
|
|
19
|
+
- [Dev Deps] update `eslint` [`02726bd`](https://github.com/inspect-js/object-inspect/commit/02726bd9df6d829020438e5a5940cbf2f4fac1ce)
|
|
20
|
+
- [Fix] guard `toStringTag` with correct ternary precedence [`012c719`](https://github.com/inspect-js/object-inspect/commit/012c71960f9fcc70b59f180f355ec752e068dcb3)
|
|
21
|
+
- [Fix] only report a null prototype when the immediate prototype is `null` [`bc9b5bb`](https://github.com/inspect-js/object-inspect/commit/bc9b5bb99a25d10b5d1275c145dcd75b7d543b12)
|
|
22
|
+
- [New] add `multilineStrings` option, to print newlines in strings as line breaks [`59f64e0`](https://github.com/inspect-js/object-inspect/commit/59f64e0220b9bc079f177b4c3791f9a9f5c7f3f3)
|
|
23
|
+
- [Fix] avoid quadratic time when inspecting collections [`46f23b9`](https://github.com/inspect-js/object-inspect/commit/46f23b985fc62841140b9c816f812d831511d98f)
|
|
24
|
+
- [actions] update workflows [`f1d2734`](https://github.com/inspect-js/object-inspect/commit/f1d273499d0da648ab68e99709178f28cad0599b)
|
|
25
|
+
- [Tests] restore the require cache via `require-stash` instead of deleting [`4cf972c`](https://github.com/inspect-js/object-inspect/commit/4cf972c77e17cf64c7f9bc18e3e160c5d1472853)
|
|
26
|
+
- [Dev Deps] update `@ljharb/eslint-config`, `auto-changelog`, `mock-property`, `npmignore`, `semver`, `tape` [`aa960eb`](https://github.com/inspect-js/object-inspect/commit/aa960ebd1eba690196c3312919a7dc24660b574d)
|
|
27
|
+
- [meta] npmignore tests [`cf245d6`](https://github.com/inspect-js/object-inspect/commit/cf245d60882b25c5c9c020b95c8ede799b43e9cd)
|
|
28
|
+
- [Dev Deps] update `eslint` [`0c6b083`](https://github.com/inspect-js/object-inspect/commit/0c6b083853b4b04964276a434263dad6c604752f)
|
|
29
|
+
- [Dev Deps] update `@ljharb/eslint-config`, `eslint`, `npmignore` [`693b6e8`](https://github.com/inspect-js/object-inspect/commit/693b6e82d841985ce7aedab192654ed70df88d03)
|
|
30
|
+
- [Dev Deps] update `@ljharb/eslint-config`, `error-cause`, `for-each` [`01f6906`](https://github.com/inspect-js/object-inspect/commit/01f6906422395d7ec69ca93fdc46c9c6662f4115)
|
|
31
|
+
- [meta] sort `devDependencies` [`09ee536`](https://github.com/inspect-js/object-inspect/commit/09ee536fd3c3a41e6f0ad7c3dabb47ade1b8c6e5)
|
|
32
|
+
- [Fix] `maxStringLength`: error message should say "non-negative", since `0` is allowed [`8d669a8`](https://github.com/inspect-js/object-inspect/commit/8d669a804bb3cf84f62d9d2b1c145d032ffaae20)
|
|
33
|
+
- [meta] Fix broken repository URL in package.json [`195f7ea`](https://github.com/inspect-js/object-inspect/commit/195f7ea1d6ce0749cf687437c226303fe9e2d96b)
|
|
34
|
+
- [Dev Deps] update `@ljharb/eslint-config` [`f5eb186`](https://github.com/inspect-js/object-inspect/commit/f5eb186e5066e071895a5916dd1a67ea706512e6)
|
|
35
|
+
- [readme] replace runkit CI badge with shields.io check-runs badge [`c32b915`](https://github.com/inspect-js/object-inspect/commit/c32b91506b44ffba774812b16e46c8ac6bf4c242)
|
|
36
|
+
- [Dev Deps] add `keyv` [`711eca7`](https://github.com/inspect-js/object-inspect/commit/711eca7871f5b215521f7633be68f253d79a2e35)
|
|
37
|
+
- [New] add `breakLength` option for single-line output [`3504471`](https://github.com/inspect-js/object-inspect/commit/3504471482fef1b7c073d164f8d78298f2f29df7)
|
|
38
|
+
|
|
8
39
|
## [v1.13.4](https://github.com/inspect-js/object-inspect/compare/v1.13.3...v1.13.4) - 2025-02-04
|
|
9
40
|
|
|
10
41
|
### Commits
|