# Extension points — immerjs/immer

> Canonical page: https://codevetter.com/unpack/immer/extension-points

# Extension points — immerjs/immer

Scanned commit 061c2425e1c9dff89e4e4189d42af1b7839dfe0a (2026-08-19). Generated by codevetter codevetter 1.15.0 on 2026-10-02.

Source inspection; upstream code and tests were not executed.

Extension mechanisms are concrete and mostly internal rather than a general third-party plugin API. The public library supports configurable instances and three enable functions, while internal typed interfaces connect implementations to scope behavior. Additional seams exist in draftable classes, producer abstractions, declaration mappings, packaging, documentation routing, and benchmark comparisons.
- New Immer instances provide independent auto-freeze, strict-copy, and iteration settings; produce is an instance arrow function, while the public singleton binds other exposed methods. — [src/core/immerClass.ts#L47-L61](https://github.com/immerjs/immer/blob/061c2425e1c9dff89e4e4189d42af1b7839dfe0a/src/core/immerClass.ts#L47-L61) [src/core/immerClass.ts#L83-L96](https://github.com/immerjs/immer/blob/061c2425e1c9dff89e4e4189d42af1b7839dfe0a/src/core/immerClass.ts#L83-L96) [src/immer.ts#L54-L79](https://github.com/immerjs/immer/blob/061c2425e1c9dff89e4e4189d42af1b7839dfe0a/src/immer.ts#L54-L79)
- The internal plugin registry has typed MapSet, Patches, and ArrayMethods slots; getPlugin rejects missing implementations and loadPlugin preserves the first loaded implementation. — [src/utils/plugins.ts#L14-L43](https://github.com/immerjs/immer/blob/061c2425e1c9dff89e4e4189d42af1b7839dfe0a/src/utils/plugins.ts#L14-L43) [src/utils/plugins.ts#L46-L77](https://github.com/immerjs/immer/blob/061c2425e1c9dff89e4e4189d42af1b7839dfe0a/src/utils/plugins.ts#L46-L77)
- Collection extension hooks return draft/state tuples and provide fixSetContents; createProxy dispatches Maps/Sets through these hooks, and finalization calls collection cleanup. — [src/utils/plugins.ts#L33-L37](https://github.com/immerjs/immer/blob/061c2425e1c9dff89e4e4189d42af1b7839dfe0a/src/utils/plugins.ts#L33-L37) [src/core/immerClass.ts#L243-L262](https://github.com/immerjs/immer/blob/061c2425e1c9dff89e4e4189d42af1b7839dfe0a/src/core/immerClass.ts#L243-L262) [src/core/finalize.ts#L182-L190](https://github.com/immerjs/immer/blob/061c2425e1c9dff89e4e4189d42af1b7839dfe0a/src/core/finalize.ts#L182-L190)
- Array-method support plugs into objectTraps.get through detection and interceptor hooks; method Sets define dispatch, and registered handlers own operation flags, mutation bookkeeping, and return semantics. — [src/utils/plugins.ts#L39-L43](https://github.com/immerjs/immer/blob/061c2425e1c9dff89e4e4189d42af1b7839dfe0a/src/utils/plugins.ts#L39-L43) [src/core/proxy.ts#L114-L122](https://github.com/immerjs/immer/blob/061c2425e1c9dff89e4e4189d42af1b7839dfe0a/src/core/proxy.ts#L114-L122) [src/plugins/arrayMethods.ts#L100-L156](https://github.com/immerjs/immer/blob/061c2425e1c9dff89e4e4189d42af1b7839dfe0a/src/plugins/arrayMethods.ts#L100-L156) [src/plugins/arrayMethods.ts#L503-L507](https://github.com/immerjs/immer/blob/061c2425e1c9dff89e4e4189d42af1b7839dfe0a/src/plugins/arrayMethods.ts#L503-L507)
- Custom classes opt into drafting by defining the exported immerable symbol on an instance or constructor; strict shallow copying preserves their prototype using descriptor-based Object.create. — [src/utils/env.ts#L8-L16](https://github.com/immerjs/immer/blob/061c2425e1c9dff89e4e4189d42af1b7839dfe0a/src/utils/env.ts#L8-L16) [src/utils/common.ts#L33-L41](https://github.com/immerjs/immer/blob/061c2425e1c9dff89e4e4189d42af1b7839dfe0a/src/utils/common.ts#L33-L41) [src/utils/common.ts#L211-L234](https://github.com/immerjs/immer/blob/061c2425e1c9dff89e4e4189d42af1b7839dfe0a/src/utils/common.ts#L211-L234)
- Libraries can build producer abstractions on createDraft/finishDraft and consume PatchListener output; these hooks reuse the same scope finalization rather than requiring a separate state engine. — [website/docs/async.mdx#L36-L38](https://github.com/immerjs/immer/blob/061c2425e1c9dff89e4e4189d42af1b7839dfe0a/website/docs/async.mdx#L36-L38) [src/core/immerClass.ts#L152-L170](https://github.com/immerjs/immer/blob/061c2425e1c9dff89e4e4189d42af1b7839dfe0a/src/core/immerClass.ts#L152-L170) [src/types/types-external.ts#L88-L94](https://github.com/immerjs/immer/blob/061c2425e1c9dff89e4e4189d42af1b7839dfe0a/src/types/types-external.ts#L88-L94)
- Public type behavior is concentrated in Draft, Immutable, IProduce, and IProduceWithPatches; distribution changes connect src/immer.ts exports to package conditions and tsup's format/declaration variants. — [src/types/types-external.ts#L58-L85](https://github.com/immerjs/immer/blob/061c2425e1c9dff89e4e4189d42af1b7839dfe0a/src/types/types-external.ts#L58-L85) [src/types/types-external.ts#L187-L225](https://github.com/immerjs/immer/blob/061c2425e1c9dff89e4e4189d42af1b7839dfe0a/src/types/types-external.ts#L187-L225) [src/types/types-external.ts#L234-L261](https://github.com/immerjs/immer/blob/061c2425e1c9dff89e4e4189d42af1b7839dfe0a/src/types/types-external.ts#L234-L261) [tsup.config.ts#L23-L52](https://github.com/immerjs/immer/blob/061c2425e1c9dff89e4e4189d42af1b7839dfe0a/tsup.config.ts#L23-L52)
- Website additions join explicit sidebar lists and Docusaurus plugins/routes; performance-provider additions join benchmark imports, the private package dependencies, and current-build aliases. — [website/sidebars.js#L1-L34](https://github.com/immerjs/immer/blob/061c2425e1c9dff89e4e4189d42af1b7839dfe0a/website/sidebars.js#L1-L34) [website/docusaurus.config.js#L73-L103](https://github.com/immerjs/immer/blob/061c2425e1c9dff89e4e4189d42af1b7839dfe0a/website/docusaurus.config.js#L73-L103) [perf-testing/immutability-benchmarks.mjs#L4-L25](https://github.com/immerjs/immer/blob/061c2425e1c9dff89e4e4189d42af1b7839dfe0a/perf-testing/immutability-benchmarks.mjs#L4-L25) [perf-testing/rolldown.config.js#L12-L16](https://github.com/immerjs/immer/blob/061c2425e1c9dff89e4e4189d42af1b7839dfe0a/perf-testing/rolldown.config.js#L12-L16)

Every claim links to its cited files at the pinned commit. Citations identify source evidence; they do not establish runtime correctness. Independent CodeVetter scan — not reviewed by upstream maintainers.

## Public product links

- [CodeVetter](https://codevetter.com/)
- [Download](https://codevetter.com/download)
- [Documentation](https://codevetter.com/docs/)
- [Source](https://github.com/Codevetter/codevetter)
