Skip to content

Commit 85faaa2

Browse files
authored
fix: Mark exports as pure, for better tree-shakability (#1124)
1 parent a8d78af commit 85faaa2

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

src/immer.ts

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,13 @@ const immer = new Immer()
4545
* @param {Function} patchListener - optional function that will be called with all the patches produced here
4646
* @returns {any} a new state, or the initial state if nothing was modified
4747
*/
48-
export const produce: IProduce = immer.produce
48+
export const produce: IProduce = /* @__PURE__ */ immer.produce
4949

5050
/**
5151
* Like `produce`, but `produceWithPatches` always returns a tuple
5252
* [nextState, patches, inversePatches] (instead of just the next state)
5353
*/
54-
export const produceWithPatches: IProduceWithPatches = immer.produceWithPatches.bind(
54+
export const produceWithPatches: IProduceWithPatches = /* @__PURE__ */ immer.produceWithPatches.bind(
5555
immer
5656
)
5757

@@ -60,27 +60,29 @@ export const produceWithPatches: IProduceWithPatches = immer.produceWithPatches.
6060
*
6161
* Always freeze by default, even in production mode
6262
*/
63-
export const setAutoFreeze = immer.setAutoFreeze.bind(immer)
63+
export const setAutoFreeze = /* @__PURE__ */ immer.setAutoFreeze.bind(immer)
6464

6565
/**
6666
* Pass true to enable strict shallow copy.
6767
*
6868
* By default, immer does not copy the object descriptors such as getter, setter and non-enumrable properties.
6969
*/
70-
export const setUseStrictShallowCopy = immer.setUseStrictShallowCopy.bind(immer)
70+
export const setUseStrictShallowCopy = /* @__PURE__ */ immer.setUseStrictShallowCopy.bind(
71+
immer
72+
)
7173

7274
/**
7375
* Apply an array of Immer patches to the first argument.
7476
*
7577
* This function is a producer, which means copy-on-write is in effect.
7678
*/
77-
export const applyPatches = immer.applyPatches.bind(immer)
79+
export const applyPatches = /* @__PURE__ */ immer.applyPatches.bind(immer)
7880

7981
/**
8082
* Create an Immer draft from the given base state, which may be a draft itself.
8183
* The draft can be modified until you finalize it with the `finishDraft` function.
8284
*/
83-
export const createDraft = immer.createDraft.bind(immer)
85+
export const createDraft = /* @__PURE__ */ immer.createDraft.bind(immer)
8486

8587
/**
8688
* Finalize an Immer draft from a `createDraft` call, returning the base state
@@ -90,7 +92,7 @@ export const createDraft = immer.createDraft.bind(immer)
9092
* Pass a function as the 2nd argument to generate Immer patches based on the
9193
* changes that were made.
9294
*/
93-
export const finishDraft = immer.finishDraft.bind(immer)
95+
export const finishDraft = /* @__PURE__ */ immer.finishDraft.bind(immer)
9496

9597
/**
9698
* This function is actually a no-op, but can be used to cast an immutable type

0 commit comments

Comments
 (0)