-
-
Notifications
You must be signed in to change notification settings - Fork 859
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Map and Set instantions won't work on certain environments, fixes …
- v10.1.1
- v10.1.0
- v10.0.4
- v10.0.3
- v10.0.2
- v10.0.1
- v10.0.0
- v9.0.21
- v9.0.20
- v9.0.19
- v9.0.18
- v9.0.17
- v9.0.16
- v9.0.15
- v9.0.14
- v9.0.13
- v9.0.12
- v9.0.11
- v9.0.10
- v9.0.9
- v9.0.8
- v9.0.7
- v9.0.6
- v9.0.5
- v9.0.4
- v9.0.3
- v9.0.2
- v9.0.1
- v9.0.0
- v8.0.4
- v8.0.3
- v8.0.2
- v8.0.1
- v8.0.0
- v7.0.15
- v7.0.14
- v7.0.13
- v7.0.12
- v7.0.11
- v7.0.10
- v7.0.9
- v7.0.8
- v7.0.7
- v7.0.6
- v7.0.5
- v7.0.4
- v7.0.3
- v7.0.2
- v7.0.1
- v7.0.0
- v6.0.9
- v6.0.8
- v6.0.7
- v6.0.6
- v6.0.5
- v6.0.4
- v6.0.3
- v6.0.2
- v6.0.1
- v6.0.0
- v5.3.6
- v5.3.5
- v5.3.4
- v5.3.3
- v5.3.2
- v5.3.1
- v5.3.0
- v5.2.1
Showing
18 changed files
with
309 additions
and
186 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// Should be no imports here! | ||
|
||
// SOme things that should be evaluated before all else... | ||
const hasSymbol = typeof Symbol !== "undefined" | ||
export const hasMap = typeof Map !== "undefined" | ||
export const hasSet = typeof Set !== "undefined" | ||
|
||
/** | ||
* The sentinel value returned by producers to replace the draft with undefined. | ||
*/ | ||
export const NOTHING: Nothing = hasSymbol | ||
? Symbol("immer-nothing") | ||
: ({["immer-nothing"]: true} as any) | ||
|
||
/** | ||
* To let Immer treat your class instances as plain immutable objects | ||
* (albeit with a custom prototype), you must define either an instance property | ||
* or a static property on each of your custom classes. | ||
* | ||
* Otherwise, your class instance will never be drafted, which means it won't be | ||
* safe to mutate in a produce callback. | ||
*/ | ||
export const DRAFTABLE: unique symbol = hasSymbol | ||
? Symbol("immer-draftable") | ||
: ("__$immer_draftable" as any) | ||
|
||
export const DRAFT_STATE: unique symbol = hasSymbol | ||
? Symbol("immer-state") | ||
: ("__$immer_state" as any) | ||
|
||
export const iteratorSymbol: typeof Symbol.iterator = hasSymbol | ||
? Symbol.iterator | ||
: ("@@iterator" as any) | ||
|
||
/** Use a class type for `nothing` so its type is unique */ | ||
export class Nothing { | ||
// This lets us do `Exclude<T, Nothing>` | ||
// @ts-ignore | ||
private _!: unique symbol | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
var extendStatics = function(d: any, b: any): any { | ||
extendStatics = | ||
Object.setPrototypeOf || | ||
({__proto__: []} instanceof Array && | ||
function(d, b) { | ||
d.__proto__ = b | ||
}) || | ||
function(d, b) { | ||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p] | ||
} | ||
return extendStatics(d, b) | ||
} | ||
|
||
// Ugly hack to resolve #502 and inherit built in Map / Set | ||
export function __extends(d: any, b: any): any { | ||
extendStatics(d, b) | ||
function __(this: any): any { | ||
this.constructor = d | ||
} | ||
d.prototype = | ||
// @ts-ignore | ||
((__.prototype = b.prototype), new __()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
export * from "./env" | ||
export * from "./extends" | ||
export * from "./types" | ||
export * from "./common" | ||
export * from "./scope" | ||
export * from "./finalize" | ||
export * from "./proxy" | ||
export * from "./es5" | ||
export * from "./map" | ||
export * from "./set" | ||
export * from "./patches" | ||
export * from "./immer" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters