Skip to content
Myr

Cleanup finalize, -57

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Michel Weststrate · committed by Michel Weststrate · parent d32cb97 · Browse files · 3 files+55 added−51 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

3 files+55 added−51 removed

  • other:+55 added−51 removed

3 files+55 added−51 removed

modified:src/finalize.ts+37 added-47 removed
modified:src/immerClass.ts+2 added-2 removed
8 unmodified lines
9 isDraftable,10 ImmerScope,11 processResult,12 NOTHING,13 maybeFreeze,13 Patch,14 Objectish,15 DRAFT_STATE,16 Draft,
7 unmodified lines
24 markChangedProxy,25 createProxyProxy26} from "./internal"27import invariant from "tiny-invariant"28import {freeze} from "./common"2930declare const __DEV__: boolean31/* istanbul ignore next */32function verifyMinified() {}
97 unmodified lines
130 } else {131 result = recipe(base)132 if (result === NOTHING) return undefined133 if (result === undefined) result = base134 maybeFreeze({immer_: this}, result, true)134 if (this.autoFreeze_) freeze(result, true)135 return result136 }137 }138
113 unmodified lines
modified:notes.txt+16 added-2 removed
3 unmodified lines
4[x] don't enable all features by default5[ ] "undefined" "object" "function" prototype undefined + buildin FNs ?6[x] kill hooks7[x] _ postfix all members8[ ] clean up finalize8[x] clean up finalize9[x] remove die10[ ] own invariant11[ ] optimize enumerations12[ ] update docs
4 unmodified lines
17[ ] kill isEnumerable?18[ ] check todos19[ ] kill marchChangesSweep recursive if possible and no perf impact20[ ] todo try immer perf on really big tree21[ ] optimize each closures away?21[ ] optimize each closures away? pass in additional args?22[ ] document performance tip: if externally added data is frozen, it doesn't recurse (also update related issue)2324Import size report for immer:25┌───────────────────────┬───────────┬────────────┬───────────┐
49 unmodified lines
75│ enablePatches │ 4154 │ 5770 │ 691 │76└───────────────────────┴───────────┴────────────┴───────────┘77(this report was generated by npmjs.com/package/import-size)78]7980After finalize cleanup: [81 Import size report for immer:82┌───────────────────────┬───────────┬────────────┬───────────┐83│ (index) │ just this │ cumulative │ increment │84├───────────────────────┼───────────┼────────────┼───────────┤85│ import * from 'immer' │ 5911 │ 0 │ 0 │86│ produce │ 3397 │ 3397 │ 0 │87│ enableES5 │ 4199 │ 4208 │ 811 │88│ enableMapSet │ 4217 │ 5001 │ 793 │89│ enablePatches │ 4091 │ 5693 │ 692 │90└───────────────────────┴───────────┴────────────┴───────────┘91(this report was generated by npmjs.com/package/import-size)92]