fix: Mark exports as pure, for better tree-shakability (#1124)
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by Steven Luscher · committed by GitHub · parent a8d78af · Browse files · 1 file·+9 added−7 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
1 file+9 added−7 removed
- other:+9 added−7 removed
Provenance
- Commit
85faaa2- Tree
b3f5aa8- Author
Steven Luscher <steveluscher@users.noreply.github.com>- Committer
GitHub <noreply@github.com>- Parent
a8d78af
1 file changed+9 added−7 removed
modified:src/immer.ts+9 added-7 removed
43 unmodified lines44454647484849505152535454555657585960616263636465666768697070717273747576777877798081828384838586878889909192939493959697989920 unmodified lines43 unmodified lines * @param {Function} producer - function that receives a proxy of the base state as first argument and which can be freely modified * @param {Function} patchListener - optional function that will be called with all the patches produced here * @returns {any} a new state, or the initial state if nothing was modified */export const produce: IProduce = immer.produceexport const produce: IProduce = /* @__PURE__ */ immer.produce
/** * Like `produce`, but `produceWithPatches` always returns a tuple * [nextState, patches, inversePatches] (instead of just the next state) */export const produceWithPatches: IProduceWithPatches = immer.produceWithPatches.bind(export const produceWithPatches: IProduceWithPatches = /* @__PURE__ */ immer.produceWithPatches.bind( immer)
/** * Pass true to automatically freeze all copies created by Immer. * * Always freeze by default, even in production mode */export const setAutoFreeze = immer.setAutoFreeze.bind(immer)export const setAutoFreeze = /* @__PURE__ */ immer.setAutoFreeze.bind(immer)
/** * Pass true to enable strict shallow copy. * * By default, immer does not copy the object descriptors such as getter, setter and non-enumrable properties. */export const setUseStrictShallowCopy = immer.setUseStrictShallowCopy.bind(immer)export const setUseStrictShallowCopy = /* @__PURE__ */ immer.setUseStrictShallowCopy.bind( immer)
/** * Apply an array of Immer patches to the first argument. * * This function is a producer, which means copy-on-write is in effect. */export const applyPatches = immer.applyPatches.bind(immer)export const applyPatches = /* @__PURE__ */ immer.applyPatches.bind(immer)
/** * Create an Immer draft from the given base state, which may be a draft itself. * The draft can be modified until you finalize it with the `finishDraft` function. */export const createDraft = immer.createDraft.bind(immer)export const createDraft = /* @__PURE__ */ immer.createDraft.bind(immer)
/** * Finalize an Immer draft from a `createDraft` call, returning the base state * (if no changes were made) or a modified copy. The draft must *not* be * mutated afterwards. * * Pass a function as the 2nd argument to generate Immer patches based on the * changes that were made. */export const finishDraft = immer.finishDraft.bind(immer)export const finishDraft = /* @__PURE__ */ immer.finishDraft.bind(immer)
/** * This function is actually a no-op, but can be used to cast an immutable type * to an draft type and make TypeScript happy20 unmodified lines