Skip to content
Myr

transpile es5 code

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 86b5d81 · Browse files · 15 files+757 added−605 removed
This commit

State

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

Diff stats

15 files+757 added−605 removed

  • tests:+7 added−7 removed
  • other:+750 added−598 removed

15 files+757 added−605 removed

modified:__performance_tests__/todo.js+1 added-1 removed
modified:__tests__/base.js+2 added-2 removed
1"use strict"2import * as immerProxy from ".."3import * as immerEs5 from "../es5"2import * as immerProxy from "../src/immer"3import * as immerEs5 from "../src/es5"4import deepFreeze from "deep-freeze"56runBaseTest("proxy (no freeze)", immerProxy, false)7runBaseTest("proxy (autofreeze)", immerProxy, true)
453 unmodified lines
modified:__tests__/curry.js+2 added-2 removed
1"use strict"2import * as immerProxy from ".."3import * as immerEs5 from "../es5"2import * as immerProxy from "../src/immer"3import * as immerEs5 from "../src/es5"45runTests("proxy", immerProxy)6runTests("es5", immerEs5)7
33 unmodified lines
modified:__tests__/frozen.js+2 added-2 removed
1"use strict"2import * as immerProxy from ".."3import * as immerEs5 from "../es5"2import * as immerProxy from "../src/immer"3import * as immerEs5 from "../src/es5"4import deepFreeze from "deep-freeze"56runTests("proxy", immerProxy)7runTests("es5", immerEs5)
50 unmodified lines
modified:__tests__/readme.js+1 added-1 removed
1"use strict"2import produce from ".."2import produce from "../src/immer"34describe("readme example", () => {5 it("works", () => {6 const baseState = [
30 unmodified lines
added:src/es5.js+277 added
1"use strict"2// @ts-check34const PROXY_STATE = Symbol("immer-proxy-state") // TODO: create per closure, to avoid sharing proxies between multiple immer version56let autoFreeze = true78/**9 * Immer takes a state, and runs a function against it.10 * That function can freely mutate the state, as it will create copies-on-write.11 * This means that the original state will stay unchanged, and once the function finishes, the modified state is returned12 *13 * @export14 * @param {any} baseState - the state to start with15 * @param {Function} producer - function that receives a proxy of the base state as first argument and which can be freely modified16 * @returns {any} a new state, or the base state if nothing was modified17 */18function produce(baseState, producer) {19 // curried invocation20 if (arguments.length === 1) {21 const producer = baseState22 // prettier-ignore23 if (typeof producer !== "function") throw new Error("if produce is called with 1 argument, the first argument should be a function")24 return function() {25 const args = arguments26 return produce(args[0], draft => {27 args[0] = draft // blegh!28 baseState.apply(null, args)29 })30 }31 }3233 // prettier-ignore34 {35 if (arguments.length !== 2) throw new Error("produce expects 1 or 2 arguments, got " + arguments.length)36 if (!isProxyable(baseState)) throw new Error("the first argument to produce should be a plain object or array, got " + (typeof baseState))37 if (typeof producer !== "function") throw new Error("the second argument to produce should be a function")38 }3940 let finalizing = false41 let finished = false42 const descriptors = {}43 const states = []4445 class State {46 constructor(parent, proxy, base) {47 this.modified = false48 this.hasCopy = false49 this.parent = parent50 this.base = base51 this.proxy = proxy52 this.copy = undefined53 }5455 get source() {56 return this.hasCopy ? this.copy : this.base57 }5859 get(prop) {60 assertUnfinished()61 const value = this.source[prop]62 if (!finalizing && !isProxy(value) && isProxyable(value)) {63 this.prepareCopy()64 return (this.copy[prop] = createProxy(this, value))65 }66 return value67 }6869 set(prop, value) {70 assertUnfinished()71 if (!this.modified) {72 if (this.source[prop] === value) return73 this.markChanged()74 }75 this.prepareCopy()76 this.copy[prop] = value77 }7879 markChanged() {80 if (!this.modified) {81 this.modified = true82 if (this.parent) this.parent.markChanged()83 }84 }8586 prepareCopy() {87 if (this.hasCopy) return88 this.hasCopy = true89 this.copy = Array.isArray(this.base)90 ? this.base.slice()91 : Object.assign({}, this.base)92 }93 }9495 // creates a proxy for plain objects / arrays96 function createProxy(parent, base) {97 let proxy98 if (Array.isArray(base)) proxy = createArrayProxy(base)99 else proxy = createObjectProxy(base)100 const state = new State(parent, proxy, base)101 createHiddenProperty(proxy, PROXY_STATE, state)102 states.push(state)103 return proxy104 }105106 function createPropertyProxy(prop) {107 return (108 descriptors[prop] ||109 (descriptors[prop] = {110 configurable: true,111 enumerable: true,112 get() {113 return this[PROXY_STATE].get(prop)114 },115 set(value) {116 this[PROXY_STATE].set(prop, value)117 }118 })119 )120 }121122 function createObjectProxy(base) {123 const proxy = Object.assign({}, base)124 Object.keys(base).forEach(prop =>125 Object.defineProperty(proxy, prop, createPropertyProxy(prop))126 )127 return proxy128 }129130 function createArrayProxy(base) {131 const proxy = new Array(base.length)132 for (let i = 0; i < base.length; i++)133 Object.defineProperty(proxy, "" + i, createPropertyProxy("" + i))134 return proxy135 }136137 function assertUnfinished() {138 if (finished)139 throw new Error(140 "Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process?"141 )142 }143144 // this sounds very expensive, but actually it is not that extensive in practice145 // as it will only visit proxies, and only do key-based change detection for objects for146 // which it is not already know that they are changed (that is, only object for which no known key was changed)147 function markChanges() {148 // intentionally we process the proxies in reverse order;149 // ideally we start by processing leafs in the tree, because if a child has changed, we don't have to check the parent anymore150 // reverse order of proxy creation approximates this151 for (let i = states.length - 1; i >= 0; i--) {152 const state = states[i]153 if (state.modified === false) {154 if (Array.isArray(state.base)) {155 if (hasArrayChanges(state)) state.markChanged()156 } else if (hasObjectChanges(state)) state.markChanged()157 }158 }159 }160161 function hasObjectChanges(state) {162 const baseKeys = Object.keys(state.base)163 const keys = Object.keys(state.proxy)164 return !shallowEqual(baseKeys, keys)165 }166167 function hasArrayChanges(state) {168 return state.proxy.length !== state.base.length169 }170171 function finalize(proxy) {172 // given a base object, returns it if unmodified, or return the changed cloned if modified173 if (!isProxy(proxy)) return proxy174 const state = proxy[PROXY_STATE]175 if (state.modified === false) return state.base // return the original target176 if (Array.isArray(proxy)) return finalizeArray(proxy)177 return finalizeObject(proxy)178 }179180 function finalizeObject(proxy) {181 const res = Object.assign({}, proxy)182 Object.keys(res).forEach(prop => {183 res[prop] = finalize(res[prop])184 })185 return freeze(res)186 }187188 function finalizeArray(proxy) {189 return freeze(proxy.map(finalize))190 }191192 // create proxy for root193 const rootClone = createProxy(undefined, baseState)194 // execute the thunk195 const maybeVoidReturn = producer(rootClone)196 //values either than undefined will trigger warning;197 !Object.is(maybeVoidReturn, undefined) &&198 console.warn(199 `Immer callback expects no return value. However ${typeof maybeVoidReturn} was returned`200 )201 // and finalize the modified proxy202 finalizing = true203 // find and mark all changes (for parts not done yet)204 markChanges()205 const res = finalize(rootClone)206 // make sure all proxies become unusable207 finished = true208 return res209}210211function isProxy(value) {212 return !!value && !!value[PROXY_STATE]213}214215function isProxyable(value) {216 if (!value) return false217 if (typeof value !== "object") return false218 if (Array.isArray(value)) return true219 const proto = Object.getPrototypeOf(value)220 return (proto === proto) === null || Object.prototype221}222223function freeze(value) {224 if (autoFreeze) {225 Object.freeze(value)226 }227 return value228}229230function createHiddenProperty(target, prop, value) {231 Object.defineProperty(target, prop, {232 value: value,233 enumerable: false,234 writable: true235 })236}237238function shallowEqual(objA, objB) {239 //From: https://github.com/facebook/fbjs/blob/c69904a511b900266935168223063dd8772dfc40/packages/fbjs/src/core/shallowEqual.js240 if (Object.is(objA, objB)) return true241 if (242 typeof objA !== "object" ||243 objA === null ||244 typeof objB !== "object" ||245 objB === null246 ) {247 return false248 }249 const keysA = Object.keys(objA)250 const keysB = Object.keys(objB)251 if (keysA.length !== keysB.length) return false252 for (let i = 0; i < keysA.length; i++) {253 if (254 !hasOwnProperty.call(objB, keysA[i]) ||255 !Object.is(objA[keysA[i]], objB[keysA[i]])256 ) {257 return false258 }259 }260 return true261}262263/**264 * Automatically freezes any state trees generated by immer.265 * This protects against accidental modifications of the state tree outside of an immer function.266 * This comes with a performance impact, so it is recommended to disable this option in production.267 * It is by default enabled.268 *269 * @returns {void}270 */271function setAutoFreeze(enableAutoFreeze) {272 autoFreeze = enableAutoFreeze273}274275createHiddenProperty(exports, "__esModule", true)276module.exports.default = produce277module.exports.setAutoFreeze = setAutoFreeze
added:src/immer.js+278 added
1"use strict"2// @ts-check34if (typeof Proxy === "undefined")5 throw new Error(6 "Immer requires `Proxy` to be available, but it seems to be not available on your platform. Consider requiring immer '\"immer/es5\"' instead."7 )89const PROXY_STATE = Symbol("immer-proxy-state") // TODO: create per closure, to avoid sharing proxies between multiple immer version10let autoFreeze = true1112const objectTraps = {13 get(target, prop) {14 if (prop === PROXY_STATE) return target15 return target.get(prop)16 },17 has(target, prop) {18 return prop in target.source19 },20 ownKeys(target) {21 return Reflect.ownKeys(target.source)22 },23 set(target, prop, value) {24 target.set(prop, value)25 return true26 },27 deleteProperty(target, prop) {28 target.deleteProp(prop)29 return true30 },31 getOwnPropertyDescriptor(target, prop) {32 return target.getOwnPropertyDescriptor(prop)33 },34 defineProperty(target, property, descriptor) {35 target.defineProperty(property, descriptor)36 return true37 },38 setPrototypeOf() {39 throw new Error("Don't even try this...")40 }41}4243const arrayTraps = {44 get(target, prop) {45 if (prop === PROXY_STATE) return target[0]46 return target[0].get(prop)47 },48 has(target, prop) {49 return prop in target[0].source50 },51 ownKeys(target) {52 return Reflect.ownKeys(target[0].source)53 },54 set(target, prop, value) {55 target[0].set(prop, value)56 return true57 },58 deleteProperty(target, prop) {59 target[0].deleteProp(prop)60 return true61 },62 getOwnPropertyDescriptor(target, prop) {63 return target[0].getOwnPropertyDescriptor(prop)64 },65 defineProperty(target, property, descriptor) {66 target[0].defineProperty(property, descriptor)67 return true68 },69 setPrototypeOf() {70 throw new Error("Don't even try this...")71 }72}7374/**75 * produce takes a state, and runs a function against it.76 * That function can freely mutate the state, as it will create copies-on-write.77 * This means that the original state will stay unchanged, and once the function finishes, the modified state is returned78 *79 * @export80 * @param {any} baseState - the state to start with81 * @param {Function} producer - function that receives a proxy of the base state as first argument and which can be freely modified82 * @returns {any} a new state, or the base state if nothing was modified83 */84function produce(baseState, producer) {85 // curried invocation86 if (arguments.length === 1) {87 const producer = baseState88 // prettier-ignore89 if (typeof producer !== "function") throw new Error("if produce is called with 1 argument, the first argument should be a function")90 return function() {91 const args = arguments92 return produce(args[0], draft => {93 args[0] = draft // blegh!94 baseState.apply(null, args)95 })96 }97 }9899 // prettier-ignore100 {101 if (arguments.length !== 2) throw new Error("produce expects 1 or 2 arguments, got " + arguments.length)102 if (!isProxyable(baseState)) throw new Error("the first argument to produce should be a plain object or array, got " + (typeof baseState))103 if (typeof producer !== "function") throw new Error("the second argument to produce should be a function")104 }105 const revocableProxies = []106107 class State {108 constructor(parent, base) {109 this.modified = false110 this.parent = parent111 this.base = base112 this.copy = undefined113 this.proxies = {}114 }115116 get source() {117 return this.modified === true ? this.copy : this.base118 }119120 get(prop) {121 if (this.modified) {122 const value = this.copy[prop]123 if (!isProxy(value) && isProxyable(value))124 return (this.copy[prop] = createProxy(this, value))125 return value126 } else {127 if (prop in this.proxies) return this.proxies[prop]128 const value = this.base[prop]129 if (!isProxy(value) && isProxyable(value))130 return (this.proxies[prop] = createProxy(this, value))131 return value132 }133 }134135 set(prop, value) {136 if (!this.modified) {137 if (138 (prop in this.base && this.base[prop] === value) ||139 (prop in this.proxies && this.proxies[prop] === value)140 )141 return142 this.markChanged()143 }144 this.copy[prop] = value145 }146147 deleteProp(prop) {148 this.markChanged()149 delete this.copy[prop]150 }151152 getOwnPropertyDescriptor(prop) {153 const owner = this.modified154 ? this.copy155 : prop in this.proxies ? this.proxies : this.base156 const descriptor = Reflect.getOwnPropertyDescriptor(owner, prop)157 if (descriptor && !(Array.isArray(owner) && prop === "length"))158 descriptor.configurable = true159 return descriptor160 }161162 defineProperty(property, descriptor) {163 throw new Error(164 "Immer does currently not support defining properties on draft objects"165 )166 }167168 markChanged() {169 if (!this.modified) {170 this.modified = true171 this.copy = Array.isArray(this.base)172 ? this.base.slice()173 : Object.assign({}, this.base) // TODO: eliminate those isArray checks?174 Object.assign(this.copy, this.proxies) // yup that works for arrays as well175 if (this.parent) this.parent.markChanged()176 }177 }178 }179180 // creates a proxy for plain objects / arrays181 function createProxy(parentState, base) {182 const state = new State(parentState, base)183 let proxy184 if (Array.isArray(base)) {185 // Proxy should be created with an array to make it an array for JS186 // so... here you have it!187 proxy = Proxy.revocable([state], arrayTraps)188 } else {189 proxy = Proxy.revocable(state, objectTraps)190 }191 revocableProxies.push(proxy)192 return proxy.proxy193 }194195 // given a base object, returns it if unmodified, or return the changed cloned if modified196 function finalize(base) {197 if (isProxy(base)) {198 const state = base[PROXY_STATE]199 if (state.modified === true) {200 if (Array.isArray(state.base)) return finalizeArray(state)201 return finalizeObject(state)202 } else return state.base203 }204 return base205 }206207 function finalizeObject(state) {208 const copy = state.copy209 Object.keys(copy).forEach(prop => {210 copy[prop] = finalize(copy[prop])211 })212 return freeze(copy)213 }214215 function finalizeArray(state) {216 const copy = state.copy217 copy.forEach((value, index) => {218 copy[index] = finalize(copy[index])219 })220 return freeze(copy)221 }222223 // create proxy for root224 const rootClone = createProxy(undefined, baseState)225 // execute the thunk226 const maybeVoidReturn = producer(rootClone)227 //values either than undefined will trigger warning;228 !Object.is(maybeVoidReturn, undefined) &&229 console.warn(230 `Immer callback expects no return value. However ${typeof maybeVoidReturn} was returned`231 )232 // and finalize the modified proxy233 const res = finalize(rootClone)234 // revoke all proxies235 revocableProxies.forEach(p => p.revoke())236 return res237}238239function isProxy(value) {240 return !!value && !!value[PROXY_STATE]241}242243function isProxyable(value) {244 if (!value) return false245 if (typeof value !== "object") return false246 if (Array.isArray(value)) return true247 const proto = Object.getPrototypeOf(value)248 return (proto === proto) === null || Object.prototype249}250251function freeze(value) {252 // short circuit to achieve 100% code coverage instead of 98%253 /*254 if(autoFreeze) {255 Object.freeze(value)256 }257 * */258 autoFreeze && Object.freeze(value)259 return value260}261262/**263 * Automatically freezes any state trees generated by immer.264 * This protects against accidental modifications of the state tree outside of an immer function.265 * This comes with a performance impact, so it is recommended to disable this option in production.266 * It is by default enabled.267 *268 * @returns {void}269 */270function setAutoFreeze(enableAutoFreeze) {271 autoFreeze = enableAutoFreeze272}273274Object.defineProperty(exports, "__esModule", {275 value: true276})277module.exports.default = produce278module.exports.setAutoFreeze = setAutoFreeze
modified:.babelrc+2 added-8 removed
1{2 "presets": [3 ["env", {4 "targets": {5 "node": "6"6 }7 }]8 ]9 }2 "presets": ["modern-browsers"]3}
modified:.gitignore+1 added-2 removed
56 unmodified lines
57# dotenv environment variables file58.env5960.idea61immer.umd.js62es5.umd.js61dist/
modified:changelog.md+4 added
1# Changelog23### 0.4.345* Make sure es5.js is transpiled67### 0.4.289* Fixed generating a wrong property descriptor for the `length` property of arrays. Fixes [#50](https://github.com/mweststrate/immer/issues/50)10* Defining custom properties on drafts is no longer supported
53 unmodified lines
modified:es5.js+1 added-277 removed
1"use strict"2// @ts-check34const PROXY_STATE = Symbol("immer-proxy-state") // TODO: create per closure, to avoid sharing proxies between multiple immer version56let autoFreeze = true78/**9 * Immer takes a state, and runs a function against it.10 * That function can freely mutate the state, as it will create copies-on-write.11 * This means that the original state will stay unchanged, and once the function finishes, the modified state is returned12 *13 * @export14 * @param {any} baseState - the state to start with15 * @param {Function} producer - function that receives a proxy of the base state as first argument and which can be freely modified16 * @returns {any} a new state, or the base state if nothing was modified17 */18function produce(baseState, producer) {19 // curried invocation20 if (arguments.length === 1) {21 const producer = baseState22 // prettier-ignore23 if (typeof producer !== "function") throw new Error("if produce is called with 1 argument, the first argument should be a function")24 return function() {25 const args = arguments26 return produce(args[0], draft => {27 args[0] = draft // blegh!28 baseState.apply(null, args)29 })30 }31 }3233 // prettier-ignore34 {35 if (arguments.length !== 2) throw new Error("produce expects 1 or 2 arguments, got " + arguments.length)36 if (!isProxyable(baseState)) throw new Error("the first argument to produce should be a plain object or array, got " + (typeof baseState))37 if (typeof producer !== "function") throw new Error("the second argument to produce should be a function")38 }3940 let finalizing = false41 let finished = false42 const descriptors = {}43 const states = []4445 class State {46 constructor(parent, proxy, base) {47 this.modified = false48 this.hasCopy = false49 this.parent = parent50 this.base = base51 this.proxy = proxy52 this.copy = undefined53 }5455 get source() {56 return this.hasCopy ? this.copy : this.base57 }5859 get(prop) {60 assertUnfinished()61 const value = this.source[prop]62 if (!finalizing && !isProxy(value) && isProxyable(value)) {63 this.prepareCopy()64 return (this.copy[prop] = createProxy(this, value))65 }66 return value67 }6869 set(prop, value) {70 assertUnfinished()71 if (!this.modified) {72 if (this.source[prop] === value) return73 this.markChanged()74 }75 this.prepareCopy()76 this.copy[prop] = value77 }7879 markChanged() {80 if (!this.modified) {81 this.modified = true82 if (this.parent) this.parent.markChanged()83 }84 }8586 prepareCopy() {87 if (this.hasCopy) return88 this.hasCopy = true89 this.copy = Array.isArray(this.base)90 ? this.base.slice()91 : Object.assign({}, this.base)92 }93 }9495 // creates a proxy for plain objects / arrays96 function createProxy(parent, base) {97 let proxy98 if (Array.isArray(base)) proxy = createArrayProxy(base)99 else proxy = createObjectProxy(base)100 const state = new State(parent, proxy, base)101 createHiddenProperty(proxy, PROXY_STATE, state)102 states.push(state)103 return proxy104 }105106 function createPropertyProxy(prop) {107 return (108 descriptors[prop] ||109 (descriptors[prop] = {110 configurable: true,111 enumerable: true,112 get() {113 return this[PROXY_STATE].get(prop)114 },115 set(value) {116 this[PROXY_STATE].set(prop, value)117 }118 })119 )120 }121122 function createObjectProxy(base) {123 const proxy = Object.assign({}, base)124 Object.keys(base).forEach(prop =>125 Object.defineProperty(proxy, prop, createPropertyProxy(prop))126 )127 return proxy128 }129130 function createArrayProxy(base) {131 const proxy = new Array(base.length)132 for (let i = 0; i < base.length; i++)133 Object.defineProperty(proxy, "" + i, createPropertyProxy("" + i))134 return proxy135 }136137 function assertUnfinished() {138 if (finished)139 throw new Error(140 "Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process?"141 )142 }143144 // this sounds very expensive, but actually it is not that extensive in practice145 // as it will only visit proxies, and only do key-based change detection for objects for146 // which it is not already know that they are changed (that is, only object for which no known key was changed)147 function markChanges() {148 // intentionally we process the proxies in reverse order;149 // ideally we start by processing leafs in the tree, because if a child has changed, we don't have to check the parent anymore150 // reverse order of proxy creation approximates this151 for (let i = states.length - 1; i >= 0; i--) {152 const state = states[i]153 if (state.modified === false) {154 if (Array.isArray(state.base)) {155 if (hasArrayChanges(state)) state.markChanged()156 } else if (hasObjectChanges(state)) state.markChanged()157 }158 }159 }160161 function hasObjectChanges(state) {162 const baseKeys = Object.keys(state.base)163 const keys = Object.keys(state.proxy)164 return !shallowEqual(baseKeys, keys)165 }166167 function hasArrayChanges(state) {168 return state.proxy.length !== state.base.length169 }170171 function finalize(proxy) {172 // given a base object, returns it if unmodified, or return the changed cloned if modified173 if (!isProxy(proxy)) return proxy174 const state = proxy[PROXY_STATE]175 if (state.modified === false) return state.base // return the original target176 if (Array.isArray(proxy)) return finalizeArray(proxy)177 return finalizeObject(proxy)178 }179180 function finalizeObject(proxy) {181 const res = Object.assign({}, proxy)182 Object.keys(res).forEach(prop => {183 res[prop] = finalize(res[prop])184 })185 return freeze(res)186 }187188 function finalizeArray(proxy) {189 return freeze(proxy.map(finalize))190 }191192 // create proxy for root193 const rootClone = createProxy(undefined, baseState)194 // execute the thunk195 const maybeVoidReturn = producer(rootClone)196 //values either than undefined will trigger warning;197 !Object.is(maybeVoidReturn, undefined) &&198 console.warn(199 `Immer callback expects no return value. However ${typeof maybeVoidReturn} was returned`200 )201 // and finalize the modified proxy202 finalizing = true203 // find and mark all changes (for parts not done yet)204 markChanges()205 const res = finalize(rootClone)206 // make sure all proxies become unusable207 finished = true208 return res209}210211function isProxy(value) {212 return !!value && !!value[PROXY_STATE]213}214215function isProxyable(value) {216 if (!value) return false217 if (typeof value !== "object") return false218 if (Array.isArray(value)) return true219 const proto = Object.getPrototypeOf(value)220 return (proto === proto) === null || Object.prototype221}222223function freeze(value) {224 if (autoFreeze) {225 Object.freeze(value)226 }227 return value228}229230function createHiddenProperty(target, prop, value) {231 Object.defineProperty(target, prop, {232 value: value,233 enumerable: false,234 writable: true235 })236}237238function shallowEqual(objA, objB) {239 //From: https://github.com/facebook/fbjs/blob/c69904a511b900266935168223063dd8772dfc40/packages/fbjs/src/core/shallowEqual.js240 if (Object.is(objA, objB)) return true241 if (242 typeof objA !== "object" ||243 objA === null ||244 typeof objB !== "object" ||245 objB === null246 ) {247 return false248 }249 const keysA = Object.keys(objA)250 const keysB = Object.keys(objB)251 if (keysA.length !== keysB.length) return false252 for (let i = 0; i < keysA.length; i++) {253 if (254 !hasOwnProperty.call(objB, keysA[i]) ||255 !Object.is(objA[keysA[i]], objB[keysA[i]])256 ) {257 return false258 }259 }260 return true261}262263/**264 * Automatically freezes any state trees generated by immer.265 * This protects against accidental modifications of the state tree outside of an immer function.266 * This comes with a performance impact, so it is recommended to disable this option in production.267 * It is by default enabled.268 *269 * @returns {void}270 */271function setAutoFreeze(enableAutoFreeze) {272 autoFreeze = enableAutoFreeze273}274275createHiddenProperty(exports, "__esModule", true)276module.exports.default = produce277module.exports.setAutoFreeze = setAutoFreeze1module.exports = require("./dist/es5.js")
deleted:immer.js-278 removed
1"use strict"2// @ts-check34if (typeof Proxy === "undefined")5 throw new Error(6 "Immer requires `Proxy` to be available, but it seems to be not available on your platform. Consider requiring immer '\"immer/es5\"' instead."7 )89const PROXY_STATE = Symbol("immer-proxy-state") // TODO: create per closure, to avoid sharing proxies between multiple immer version10let autoFreeze = true1112const objectTraps = {13 get(target, prop) {14 if (prop === PROXY_STATE) return target15 return target.get(prop)16 },17 has(target, prop) {18 return prop in target.source19 },20 ownKeys(target) {21 return Reflect.ownKeys(target.source)22 },23 set(target, prop, value) {24 target.set(prop, value)25 return true26 },27 deleteProperty(target, prop) {28 target.deleteProp(prop)29 return true30 },31 getOwnPropertyDescriptor(target, prop) {32 return target.getOwnPropertyDescriptor(prop)33 },34 defineProperty(target, property, descriptor) {35 target.defineProperty(property, descriptor)36 return true37 },38 setPrototypeOf() {39 throw new Error("Don't even try this...")40 }41}4243const arrayTraps = {44 get(target, prop) {45 if (prop === PROXY_STATE) return target[0]46 return target[0].get(prop)47 },48 has(target, prop) {49 return prop in target[0].source50 },51 ownKeys(target) {52 return Reflect.ownKeys(target[0].source)53 },54 set(target, prop, value) {55 target[0].set(prop, value)56 return true57 },58 deleteProperty(target, prop) {59 target[0].deleteProp(prop)60 return true61 },62 getOwnPropertyDescriptor(target, prop) {63 return target[0].getOwnPropertyDescriptor(prop)64 },65 defineProperty(target, property, descriptor) {66 target[0].defineProperty(property, descriptor)67 return true68 },69 setPrototypeOf() {70 throw new Error("Don't even try this...")71 }72}7374/**75 * produce takes a state, and runs a function against it.76 * That function can freely mutate the state, as it will create copies-on-write.77 * This means that the original state will stay unchanged, and once the function finishes, the modified state is returned78 *79 * @export80 * @param {any} baseState - the state to start with81 * @param {Function} producer - function that receives a proxy of the base state as first argument and which can be freely modified82 * @returns {any} a new state, or the base state if nothing was modified83 */84function produce(baseState, producer) {85 // curried invocation86 if (arguments.length === 1) {87 const producer = baseState88 // prettier-ignore89 if (typeof producer !== "function") throw new Error("if produce is called with 1 argument, the first argument should be a function")90 return function() {91 const args = arguments92 return produce(args[0], draft => {93 args[0] = draft // blegh!94 baseState.apply(null, args)95 })96 }97 }9899 // prettier-ignore100 {101 if (arguments.length !== 2) throw new Error("produce expects 1 or 2 arguments, got " + arguments.length)102 if (!isProxyable(baseState)) throw new Error("the first argument to produce should be a plain object or array, got " + (typeof baseState))103 if (typeof producer !== "function") throw new Error("the second argument to produce should be a function")104 }105 const revocableProxies = []106107 class State {108 constructor(parent, base) {109 this.modified = false110 this.parent = parent111 this.base = base112 this.copy = undefined113 this.proxies = {}114 }115116 get source() {117 return this.modified === true ? this.copy : this.base118 }119120 get(prop) {121 if (this.modified) {122 const value = this.copy[prop]123 if (!isProxy(value) && isProxyable(value))124 return (this.copy[prop] = createProxy(this, value))125 return value126 } else {127 if (prop in this.proxies) return this.proxies[prop]128 const value = this.base[prop]129 if (!isProxy(value) && isProxyable(value))130 return (this.proxies[prop] = createProxy(this, value))131 return value132 }133 }134135 set(prop, value) {136 if (!this.modified) {137 if (138 (prop in this.base && this.base[prop] === value) ||139 (prop in this.proxies && this.proxies[prop] === value)140 )141 return142 this.markChanged()143 }144 this.copy[prop] = value145 }146147 deleteProp(prop) {148 this.markChanged()149 delete this.copy[prop]150 }151152 getOwnPropertyDescriptor(prop) {153 const owner = this.modified154 ? this.copy155 : prop in this.proxies ? this.proxies : this.base156 const descriptor = Reflect.getOwnPropertyDescriptor(owner, prop)157 if (descriptor && !(Array.isArray(owner) && prop === "length"))158 descriptor.configurable = true159 return descriptor160 }161162 defineProperty(property, descriptor) {163 throw new Error(164 "Immer does currently not support defining properties on draft objects"165 )166 }167168 markChanged() {169 if (!this.modified) {170 this.modified = true171 this.copy = Array.isArray(this.base)172 ? this.base.slice()173 : Object.assign({}, this.base) // TODO: eliminate those isArray checks?174 Object.assign(this.copy, this.proxies) // yup that works for arrays as well175 if (this.parent) this.parent.markChanged()176 }177 }178 }179180 // creates a proxy for plain objects / arrays181 function createProxy(parentState, base) {182 const state = new State(parentState, base)183 let proxy184 if (Array.isArray(base)) {185 // Proxy should be created with an array to make it an array for JS186 // so... here you have it!187 proxy = Proxy.revocable([state], arrayTraps)188 } else {189 proxy = Proxy.revocable(state, objectTraps)190 }191 revocableProxies.push(proxy)192 return proxy.proxy193 }194195 // given a base object, returns it if unmodified, or return the changed cloned if modified196 function finalize(base) {197 if (isProxy(base)) {198 const state = base[PROXY_STATE]199 if (state.modified === true) {200 if (Array.isArray(state.base)) return finalizeArray(state)201 return finalizeObject(state)202 } else return state.base203 }204 return base205 }206207 function finalizeObject(state) {208 const copy = state.copy209 Object.keys(copy).forEach(prop => {210 copy[prop] = finalize(copy[prop])211 })212 return freeze(copy)213 }214215 function finalizeArray(state) {216 const copy = state.copy217 copy.forEach((value, index) => {218 copy[index] = finalize(copy[index])219 })220 return freeze(copy)221 }222223 // create proxy for root224 const rootClone = createProxy(undefined, baseState)225 // execute the thunk226 const maybeVoidReturn = producer(rootClone)227 //values either than undefined will trigger warning;228 !Object.is(maybeVoidReturn, undefined) &&229 console.warn(230 `Immer callback expects no return value. However ${typeof maybeVoidReturn} was returned`231 )232 // and finalize the modified proxy233 const res = finalize(rootClone)234 // revoke all proxies235 revocableProxies.forEach(p => p.revoke())236 return res237}238239function isProxy(value) {240 return !!value && !!value[PROXY_STATE]241}242243function isProxyable(value) {244 if (!value) return false245 if (typeof value !== "object") return false246 if (Array.isArray(value)) return true247 const proto = Object.getPrototypeOf(value)248 return (proto === proto) === null || Object.prototype249}250251function freeze(value) {252 // short circuit to achieve 100% code coverage instead of 98%253 /*254 if(autoFreeze) {255 Object.freeze(value)256 }257 * */258 autoFreeze && Object.freeze(value)259 return value260}261262/**263 * Automatically freezes any state trees generated by immer.264 * This protects against accidental modifications of the state tree outside of an immer function.265 * This comes with a performance impact, so it is recommended to disable this option in production.266 * It is by default enabled.267 *268 * @returns {void}269 */270function setAutoFreeze(enableAutoFreeze) {271 autoFreeze = enableAutoFreeze272}273274Object.defineProperty(exports, "__esModule", {275 value: true276})277module.exports.default = produce278module.exports.setAutoFreeze = setAutoFreeze
modified:package.json+11 added-8 removed
1{2 "name": "immer",3 "version": "0.4.2",4 "description": "Create your next immutable state by mutating the current one",5 "main": "immer.js",5 "main": "dist/immer.js",6 "types": "./index.d.ts",7 "scripts": {8 "test": "jest",9 "test:perf": "node --expose-gc node_modules/jest-cli/bin/jest.js --verbose --testRegex '__performance_tests__/.*'",9 "test:perf": "yarn build:babel && node --expose-gc node_modules/jest-cli/bin/jest.js --verbose --testRegex '__performance_tests__/.*'",10 "coveralls": "jest --coverage && cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js && rm -rf ./coverage",11 "build": "yarn build:babel && yarn build:umd",12 "build:babel": "cd src && babel -d ../dist immer.js && babel --no-babelrc --presets=es2015 -d ../dist es5.js",13 "build:umd": "browserify dist/immer.js -o dist/immer.umd.js -s immer && browserify dist/es5.js -o dist/es5.umd.js -s immer",14 "prettier": "prettier \"*/**/*.js\" --ignore-path ./.prettierignore --write",12 "build:umd": "browserify immer.js -o immer.umd.js -s immer && browserify es5.js -o es5.umd.js -s immer",13 "prepublish": "yarn build:umd"15 "prepublish": "yarn build"16 },17 "pre-commit": [18 "prettier"19 ],
12 unmodified lines
32 "url": "https://github.com/mweststrate/immer/issues"33 },34 "homepage": "https://github.com/mweststrate/immer#readme",35 "files": [34 "immer.js",35 "immer.umd.js",36 "es5.js",37 "es5.umd.js",38 "index.d.ts"37 "index.d.ts",38 "dist/"39 ],40 "devDependencies": {41 "@types/jest": "^22.0.0",42 "babel-cli": "^6.26.0",43 "babel-core": "^6.26.0",44 "babel-jest": "^22.0.4",45 "babel-preset-env": "^1.6.1",46 "babel-preset-es2015": "^6.24.1",47 "babel-preset-modern-browsers": "^10.0.1",48 "browserify": "^15.0.0",49 "coveralls": "^3.0.0",50 "deep-freeze": "^0.0.1",51 "immutable": "^3.8.2",
13 unmodified lines
modified:readme.md+6 added-4 removed
8 unmodified lines
910---1112* NPM / Yarn: `npm install immer`13* CDN: https://unpkg.com/immer/immer.umd.js or https://unpkg.com/immer/es5.umd.js. Exposed global is `immer`.13* CDN: https://unpkg.com/immer/dist/immer.umd.js or https://unpkg.com/immer/dist/es5.umd.js. Exposed global is `immer`.1415Immer (German for: always) is a tiny package that allows you to work with immutable state in a more convenient way.16It is based on the [_copy-on-write_](https://en.wikipedia.org/wiki/Copy-on-write) mechanism.17
104 unmodified lines
122 }123 })124```125126Note that it is not needed to handle the default case, a producer that doesn't do anything will simply return the original state.126Notice that it is not needed to handle the default case, a producer that doesn't do anything will simply return the original state.127128_Note, creating Redux reducer is just a sample application of the Immer package.128Creating Redux reducer is just a sample application of the Immer package.129Immer is not just designed to simplify Redux reducers.130It can be used in any context where you have an immutable data tree that you want to clone and modify (with structural sharing)_130It can be used in any context where you have an immutable data tree that you want to clone and modify (with structural sharing).131132_Note: it might be tempting after using producers a while, to just put `produce` in your root reducer, and then past the draft along to each reducer and work on that. Don't do that. It kills the point of Redux where each reducer is testable as pure reducer. Immer is best used when applying it to small individual pieces of logic._133134## Currying135136`produce` can be called with one or two arguments.137The one argument version is intended to be used as currying. This means that you get a pre-pound producer, that only needs a state to produce the value from.
153 unmodified lines
modified:yarn.lock+169 added-20 removed
201 unmodified lines
202 resolved "https://registry.yarnpkg.com/astw/-/astw-2.2.0.tgz#7bd41784d32493987aeb239b6b4e1c57a873b917"203 dependencies:204 acorn "^4.0.3"205206async-each@^1.0.0:207 version "1.0.1"208 resolved "https://registry.yarnpkg.com/async-each/-/async-each-1.0.1.tgz#19d386a1d9edc6e7c1c85d388aedbcc56d33602d"209210async@^1.4.0:211 version "1.5.2"212 resolved "https://registry.yarnpkg.com/async/-/async-1.5.2.tgz#ec6a61ae56480c0c3cb241c95618e20892f9672a"213
18 unmodified lines
232aws4@^1.2.1, aws4@^1.6.0:233 version "1.6.0"234 resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.6.0.tgz#83ef5ca860b2b32e4a0deedee8c771b9db57471e"235236babel-cli@^6.26.0:237 version "6.26.0"238 resolved "https://registry.yarnpkg.com/babel-cli/-/babel-cli-6.26.0.tgz#502ab54874d7db88ad00b887a06383ce03d002f1"239 dependencies:240 babel-core "^6.26.0"241 babel-polyfill "^6.26.0"242 babel-register "^6.26.0"243 babel-runtime "^6.26.0"244 commander "^2.11.0"245 convert-source-map "^1.5.0"246 fs-readdir-recursive "^1.0.0"247 glob "^7.1.2"248 lodash "^4.17.4"249 output-file-sync "^1.1.2"250 path-is-absolute "^1.0.1"251 slash "^1.0.0"252 source-map "^0.5.6"253 v8flags "^2.1.1"254 optionalDependencies:255 chokidar "^1.6.1"256257babel-code-frame@^6.26.0:258 version "6.26.0"259 resolved "https://registry.yarnpkg.com/babel-code-frame/-/babel-code-frame-6.26.0.tgz#63fd43f7dc1e3bb7ce35947db8fe369a3f58c74b"260 dependencies:
177 unmodified lines
438babel-plugin-syntax-exponentiation-operator@^6.8.0:439 version "6.13.0"440 resolved "https://registry.yarnpkg.com/babel-plugin-syntax-exponentiation-operator/-/babel-plugin-syntax-exponentiation-operator-6.13.0.tgz#9ee7e8337290da95288201a6a57f4170317830de"441417babel-plugin-syntax-object-rest-spread@^6.13.0:442babel-plugin-syntax-object-rest-spread@^6.13.0, babel-plugin-syntax-object-rest-spread@^6.8.0:443 version "6.13.0"444 resolved "https://registry.yarnpkg.com/babel-plugin-syntax-object-rest-spread/-/babel-plugin-syntax-object-rest-spread-6.13.0.tgz#fd6536f2bce13836ffa3a5458c4903a597bb3bf5"445446babel-plugin-syntax-trailing-function-commas@^6.22.0:
19 unmodified lines
466 resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-block-scoped-functions/-/babel-plugin-transform-es2015-block-scoped-functions-6.22.0.tgz#bbc51b49f964d70cb8d8e0b94e820246ce3a6141"467 dependencies:468 babel-runtime "^6.22.0"469445babel-plugin-transform-es2015-block-scoping@^6.23.0:470babel-plugin-transform-es2015-block-scoping@^6.23.0, babel-plugin-transform-es2015-block-scoping@^6.24.1:471 version "6.26.0"472 resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-block-scoping/-/babel-plugin-transform-es2015-block-scoping-6.26.0.tgz#d70f5299c1308d05c12f463813b0a09e73b1895f"473 dependencies:474 babel-runtime "^6.26.0"
1 unmodified line
476 babel-traverse "^6.26.0"477 babel-types "^6.26.0"478 lodash "^4.17.4"479455babel-plugin-transform-es2015-classes@^6.23.0:480babel-plugin-transform-es2015-classes@^6.23.0, babel-plugin-transform-es2015-classes@^6.24.1:481 version "6.24.1"482 resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-classes/-/babel-plugin-transform-es2015-classes-6.24.1.tgz#5a4c58a50c9c9461e564b4b2a3bfabc97a2584db"483 dependencies:484 babel-helper-define-map "^6.24.1"
5 unmodified lines
490 babel-template "^6.24.1"491 babel-traverse "^6.24.1"492 babel-types "^6.24.1"493469babel-plugin-transform-es2015-computed-properties@^6.22.0:494babel-plugin-transform-es2015-computed-properties@^6.22.0, babel-plugin-transform-es2015-computed-properties@^6.24.1:495 version "6.24.1"496 resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-computed-properties/-/babel-plugin-transform-es2015-computed-properties-6.24.1.tgz#6fe2a8d16895d5634f4cd999b6d3480a308159b3"497 dependencies:498 babel-runtime "^6.22.0"499 babel-template "^6.24.1"500476babel-plugin-transform-es2015-destructuring@^6.23.0:501babel-plugin-transform-es2015-destructuring@^6.22.0, babel-plugin-transform-es2015-destructuring@^6.23.0:502 version "6.23.0"503 resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-destructuring/-/babel-plugin-transform-es2015-destructuring-6.23.0.tgz#997bb1f1ab967f682d2b0876fe358d60e765c56d"504 dependencies:505 babel-runtime "^6.22.0"506482babel-plugin-transform-es2015-duplicate-keys@^6.22.0:507babel-plugin-transform-es2015-duplicate-keys@^6.22.0, babel-plugin-transform-es2015-duplicate-keys@^6.24.1:508 version "6.24.1"509 resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-duplicate-keys/-/babel-plugin-transform-es2015-duplicate-keys-6.24.1.tgz#73eb3d310ca969e3ef9ec91c53741a6f1576423e"510 dependencies:511 babel-runtime "^6.22.0"512 babel-types "^6.24.1"513489babel-plugin-transform-es2015-for-of@^6.23.0:514babel-plugin-transform-es2015-for-of@^6.22.0, babel-plugin-transform-es2015-for-of@^6.23.0:515 version "6.23.0"516 resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-for-of/-/babel-plugin-transform-es2015-for-of-6.23.0.tgz#f47c95b2b613df1d3ecc2fdb7573623c75248691"517 dependencies:518 babel-runtime "^6.22.0"519495babel-plugin-transform-es2015-function-name@^6.22.0:520babel-plugin-transform-es2015-function-name@^6.22.0, babel-plugin-transform-es2015-function-name@^6.24.1:521 version "6.24.1"522 resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-function-name/-/babel-plugin-transform-es2015-function-name-6.24.1.tgz#834c89853bc36b1af0f3a4c5dbaa94fd8eacaa8b"523 dependencies:524 babel-helper-function-name "^6.24.1"
13 unmodified lines
538 babel-plugin-transform-es2015-modules-commonjs "^6.24.1"539 babel-runtime "^6.22.0"540 babel-template "^6.24.1"541517babel-plugin-transform-es2015-modules-commonjs@^6.23.0, babel-plugin-transform-es2015-modules-commonjs@^6.24.1:542babel-plugin-transform-es2015-modules-commonjs@^6.23.0, babel-plugin-transform-es2015-modules-commonjs@^6.24.1, babel-plugin-transform-es2015-modules-commonjs@^6.26.0:543 version "6.26.0"544 resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-modules-commonjs/-/babel-plugin-transform-es2015-modules-commonjs-6.26.0.tgz#0d8394029b7dc6abe1a97ef181e00758dd2e5d8a"545 dependencies:546 babel-plugin-transform-strict-mode "^6.24.1"547 babel-runtime "^6.26.0"548 babel-template "^6.26.0"549 babel-types "^6.26.0"550526babel-plugin-transform-es2015-modules-systemjs@^6.23.0:551babel-plugin-transform-es2015-modules-systemjs@^6.23.0, babel-plugin-transform-es2015-modules-systemjs@^6.24.1:552 version "6.24.1"553 resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-modules-systemjs/-/babel-plugin-transform-es2015-modules-systemjs-6.24.1.tgz#ff89a142b9119a906195f5f106ecf305d9407d23"554 dependencies:555 babel-helper-hoist-variables "^6.24.1"556 babel-runtime "^6.22.0"557 babel-template "^6.24.1"558534babel-plugin-transform-es2015-modules-umd@^6.23.0:559babel-plugin-transform-es2015-modules-umd@^6.23.0, babel-plugin-transform-es2015-modules-umd@^6.24.1:560 version "6.24.1"561 resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-modules-umd/-/babel-plugin-transform-es2015-modules-umd-6.24.1.tgz#ac997e6285cd18ed6176adb607d602344ad38468"562 dependencies:563 babel-plugin-transform-es2015-modules-amd "^6.24.1"564 babel-runtime "^6.22.0"565 babel-template "^6.24.1"566542babel-plugin-transform-es2015-object-super@^6.22.0:567babel-plugin-transform-es2015-object-super@^6.22.0, babel-plugin-transform-es2015-object-super@^6.24.1:568 version "6.24.1"569 resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-object-super/-/babel-plugin-transform-es2015-object-super-6.24.1.tgz#24cef69ae21cb83a7f8603dad021f572eb278f8d"570 dependencies:571 babel-helper-replace-supers "^6.24.1"572 babel-runtime "^6.22.0"573549babel-plugin-transform-es2015-parameters@^6.23.0:574babel-plugin-transform-es2015-parameters@^6.23.0, babel-plugin-transform-es2015-parameters@^6.24.1:575 version "6.24.1"576 resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-parameters/-/babel-plugin-transform-es2015-parameters-6.24.1.tgz#57ac351ab49caf14a97cd13b09f66fdf0a625f2b"577 dependencies:578 babel-helper-call-delegate "^6.24.1"
2 unmodified lines
581 babel-template "^6.24.1"582 babel-traverse "^6.24.1"583 babel-types "^6.24.1"584560babel-plugin-transform-es2015-shorthand-properties@^6.22.0:585babel-plugin-transform-es2015-shorthand-properties@^6.22.0, babel-plugin-transform-es2015-shorthand-properties@^6.24.1:586 version "6.24.1"587 resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-shorthand-properties/-/babel-plugin-transform-es2015-shorthand-properties-6.24.1.tgz#24f875d6721c87661bbd99a4622e51f14de38aa0"588 dependencies:589 babel-runtime "^6.22.0"
4 unmodified lines
594 resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-spread/-/babel-plugin-transform-es2015-spread-6.22.0.tgz#d6d68a99f89aedc4536c81a542e8dd9f1746f8d1"595 dependencies:596 babel-runtime "^6.22.0"597573babel-plugin-transform-es2015-sticky-regex@^6.22.0:598babel-plugin-transform-es2015-sticky-regex@^6.22.0, babel-plugin-transform-es2015-sticky-regex@^6.24.1:599 version "6.24.1"600 resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-sticky-regex/-/babel-plugin-transform-es2015-sticky-regex-6.24.1.tgz#00c1cdb1aca71112cdf0cf6126c2ed6b457ccdbc"601 dependencies:602 babel-helper-regex "^6.24.1"
5 unmodified lines
608 resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-template-literals/-/babel-plugin-transform-es2015-template-literals-6.22.0.tgz#a84b3450f7e9f8f1f6839d6d687da84bb1236d8d"609 dependencies:610 babel-runtime "^6.22.0"611587babel-plugin-transform-es2015-typeof-symbol@^6.23.0:612babel-plugin-transform-es2015-typeof-symbol@^6.22.0, babel-plugin-transform-es2015-typeof-symbol@^6.23.0:613 version "6.23.0"614 resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-typeof-symbol/-/babel-plugin-transform-es2015-typeof-symbol-6.23.0.tgz#dec09f1cddff94b52ac73d505c84df59dcceb372"615 dependencies:616 babel-runtime "^6.22.0"617593babel-plugin-transform-es2015-unicode-regex@^6.22.0:618babel-plugin-transform-es2015-unicode-regex@^6.22.0, babel-plugin-transform-es2015-unicode-regex@^6.24.1:619 version "6.24.1"620 resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-unicode-regex/-/babel-plugin-transform-es2015-unicode-regex-6.24.1.tgz#d38b12f42ea7323f729387f18a7c5ae1faeb35e9"621 dependencies:622 babel-helper-regex "^6.24.1"
7 unmodified lines
630 babel-helper-builder-binary-assignment-operator-visitor "^6.24.1"631 babel-plugin-syntax-exponentiation-operator "^6.8.0"632 babel-runtime "^6.22.0"633609babel-plugin-transform-regenerator@^6.22.0:634babel-plugin-transform-object-rest-spread@^6.26.0:635 version "6.26.0"636 resolved "https://registry.yarnpkg.com/babel-plugin-transform-object-rest-spread/-/babel-plugin-transform-object-rest-spread-6.26.0.tgz#0f36692d50fef6b7e2d4b3ac1478137a963b7b06"637 dependencies:638 babel-plugin-syntax-object-rest-spread "^6.8.0"639 babel-runtime "^6.26.0"640641babel-plugin-transform-regenerator@^6.22.0, babel-plugin-transform-regenerator@^6.24.1:642 version "6.26.0"643 resolved "https://registry.yarnpkg.com/babel-plugin-transform-regenerator/-/babel-plugin-transform-regenerator-6.26.0.tgz#e0703696fbde27f0a3efcacf8b4dca2f7b3a8f2f"644 dependencies:645 regenerator-transform "^0.10.0"646
3 unmodified lines
650 dependencies:651 babel-runtime "^6.22.0"652 babel-types "^6.24.1"653654babel-polyfill@^6.26.0:655 version "6.26.0"656 resolved "https://registry.yarnpkg.com/babel-polyfill/-/babel-polyfill-6.26.0.tgz#379937abc67d7895970adc621f284cd966cf2153"657 dependencies:658 babel-runtime "^6.26.0"659 core-js "^2.5.0"660 regenerator-runtime "^0.10.5"661662babel-preset-env@^1.6.1:663 version "1.6.1"664 resolved "https://registry.yarnpkg.com/babel-preset-env/-/babel-preset-env-1.6.1.tgz#a18b564cc9b9afdf4aae57ae3c1b0d99188e6f48"665 dependencies:
27 unmodified lines
693 browserslist "^2.1.2"694 invariant "^2.2.2"695 semver "^5.3.0"696697babel-preset-es2015@^6.24.1:698 version "6.24.1"699 resolved "https://registry.yarnpkg.com/babel-preset-es2015/-/babel-preset-es2015-6.24.1.tgz#d44050d6bc2c9feea702aaf38d727a0210538939"700 dependencies:701 babel-plugin-check-es2015-constants "^6.22.0"702 babel-plugin-transform-es2015-arrow-functions "^6.22.0"703 babel-plugin-transform-es2015-block-scoped-functions "^6.22.0"704 babel-plugin-transform-es2015-block-scoping "^6.24.1"705 babel-plugin-transform-es2015-classes "^6.24.1"706 babel-plugin-transform-es2015-computed-properties "^6.24.1"707 babel-plugin-transform-es2015-destructuring "^6.22.0"708 babel-plugin-transform-es2015-duplicate-keys "^6.24.1"709 babel-plugin-transform-es2015-for-of "^6.22.0"710 babel-plugin-transform-es2015-function-name "^6.24.1"711 babel-plugin-transform-es2015-literals "^6.22.0"712 babel-plugin-transform-es2015-modules-amd "^6.24.1"713 babel-plugin-transform-es2015-modules-commonjs "^6.24.1"714 babel-plugin-transform-es2015-modules-systemjs "^6.24.1"715 babel-plugin-transform-es2015-modules-umd "^6.24.1"716 babel-plugin-transform-es2015-object-super "^6.24.1"717 babel-plugin-transform-es2015-parameters "^6.24.1"718 babel-plugin-transform-es2015-shorthand-properties "^6.24.1"719 babel-plugin-transform-es2015-spread "^6.22.0"720 babel-plugin-transform-es2015-sticky-regex "^6.24.1"721 babel-plugin-transform-es2015-template-literals "^6.22.0"722 babel-plugin-transform-es2015-typeof-symbol "^6.22.0"723 babel-plugin-transform-es2015-unicode-regex "^6.24.1"724 babel-plugin-transform-regenerator "^6.24.1"725726babel-preset-jest@^22.0.3:727 version "22.0.3"728 resolved "https://registry.yarnpkg.com/babel-preset-jest/-/babel-preset-jest-22.0.3.tgz#e2bb6f6b4a509d3ea0931f013db78c5a84856693"729 dependencies:730 babel-plugin-jest-hoist "^22.0.3"731 babel-plugin-syntax-object-rest-spread "^6.13.0"732733babel-preset-modern-browsers@^10.0.1:734 version "10.0.1"735 resolved "https://registry.yarnpkg.com/babel-preset-modern-browsers/-/babel-preset-modern-browsers-10.0.1.tgz#8d7bc356e76a27881b7c3fb4ea6cfb9a3d81aae6"736 dependencies:737 babel-plugin-check-es2015-constants "^6.22.0"738 babel-plugin-syntax-object-rest-spread "^6.13.0"739 babel-plugin-syntax-trailing-function-commas "^6.22.0"740 babel-plugin-transform-es2015-arrow-functions "^6.22.0"741 babel-plugin-transform-es2015-function-name "^6.24.1"742 babel-plugin-transform-es2015-modules-commonjs "^6.26.0"743 babel-plugin-transform-object-rest-spread "^6.26.0"744745babel-register@^6.26.0:746 version "6.26.0"747 resolved "https://registry.yarnpkg.com/babel-register/-/babel-register-6.26.0.tgz#6ed021173e2fcb486d7acb45c6009a856f647071"748 dependencies:
62 unmodified lines
811 resolved "https://registry.yarnpkg.com/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.1.tgz#63bc5dcb61331b92bc05fd528953c33462a06f8d"812 dependencies:813 tweetnacl "^0.14.3"814815binary-extensions@^1.0.0:816 version "1.11.0"817 resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-1.11.0.tgz#46aa1751fb6a2f93ee5e689bb1087d4b14c6c205"818819bindings@^1.2.1:820 version "1.3.0"821 resolved "https://registry.yarnpkg.com/bindings/-/bindings-1.3.0.tgz#b346f6ecf6a95f5a815c5839fc7cdb22502f1ed7"822
248 unmodified lines
1071 ansi-styles "^3.1.0"1072 escape-string-regexp "^1.0.5"1073 supports-color "^4.0.0"10741075chokidar@^1.6.1:1076 version "1.7.0"1077 resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-1.7.0.tgz#798e689778151c8076b4b360e5edd28cda2bb468"1078 dependencies:1079 anymatch "^1.3.0"1080 async-each "^1.0.0"1081 glob-parent "^2.0.0"1082 inherits "^2.0.1"1083 is-binary-path "^1.0.0"1084 is-glob "^2.0.0"1085 path-is-absolute "^1.0.0"1086 readdirp "^2.0.0"1087 optionalDependencies:1088 fsevents "^1.0.0"10891090ci-info@^1.0.0:1091 version "1.1.2"1092 resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-1.1.2.tgz#03561259db48d0474c8bdc90f5b47b068b6bbfb4"1093
52 unmodified lines
1146 resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.5.tgz#938370a57b4a51dea2c77c15d5c5fdf895164009"1147 dependencies:1148 delayed-stream "~1.0.0"11491150commander@^2.11.0:1151 version "2.12.2"1152 resolved "https://registry.yarnpkg.com/commander/-/commander-2.12.2.tgz#0f5946c427ed9ec0d91a46bb9def53e54650e555"11531154concat-map@0.0.1:1155 version "0.0.1"1156 resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b"1157
495 unmodified lines
1653 asynckit "^0.4.0"1654 combined-stream "^1.0.5"1655 mime-types "^2.1.12"16561657fs-readdir-recursive@^1.0.0:1658 version "1.1.0"1659 resolved "https://registry.yarnpkg.com/fs-readdir-recursive/-/fs-readdir-recursive-1.1.0.tgz#e32fc030a2ccee44a6b5371308da54be0b397d27"16601661fs.realpath@^1.0.0:1662 version "1.0.0"1663 resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f"16641557fsevents@^1.1.1:1665fsevents@^1.0.0, fsevents@^1.1.1:1666 version "1.1.3"1667 resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-1.1.3.tgz#11f82318f5fe7bb2cd22965a108e9306208216d8"1668 dependencies:1669 nan "^2.3.0"
74 unmodified lines
1744globals@^9.18.0:1745 version "9.18.0"1746 resolved "https://registry.yarnpkg.com/globals/-/globals-9.18.0.tgz#aa3896b3e69b487f17e31ed2143d69a8e30c2d8a"17471640graceful-fs@^4.1.11, graceful-fs@^4.1.2:1748graceful-fs@^4.1.11, graceful-fs@^4.1.2, graceful-fs@^4.1.4:1749 version "4.1.11"1750 resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.1.11.tgz#0e8bdfe4d1ddb8854d64e04ea7c00e2a026e5658"17511752growly@^1.3.0:
222 unmodified lines
1975is-arrayish@^0.2.1:1976 version "0.2.1"1977 resolved "https://registry.yarnpkg.com/is-arrayish/-/is-arrayish-0.2.1.tgz#77c99840527aa8ecb1a8ba697b80645a7a926a9d"19781979is-binary-path@^1.0.0:1980 version "1.0.1"1981 resolved "https://registry.yarnpkg.com/is-binary-path/-/is-binary-path-1.0.1.tgz#75f16642b480f187a711c814161fd3a4a7655898"1982 dependencies:1983 binary-extensions "^1.0.0"19841985is-buffer@^1.1.0, is-buffer@^1.1.5:1986 version "1.1.6"1987 resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-1.1.6.tgz#efaa2ea9daa0d7ab2ea13a97b2b8ad51fefbe8be"1988
922 unmodified lines
2911 dependencies:2912 os-homedir "^1.0.0"2913 os-tmpdir "^1.0.0"29142915output-file-sync@^1.1.2:2916 version "1.1.2"2917 resolved "https://registry.yarnpkg.com/output-file-sync/-/output-file-sync-1.1.2.tgz#d0a33eefe61a205facb90092e826598d5245ce76"2918 dependencies:2919 graceful-fs "^4.1.4"2920 mkdirp "^0.5.1"2921 object-assign "^4.1.0"29222923p-finally@^1.0.0:2924 version "1.0.0"2925 resolved "https://registry.yarnpkg.com/p-finally/-/p-finally-1.0.0.tgz#3fbcfb15b899a44123b34b6dcc18b724336a2cae"2926
275 unmodified lines
3202 process-nextick-args "~1.0.6"3203 string_decoder "~0.10.x"3204 util-deprecate "~1.0.1"32053206readdirp@^2.0.0:3207 version "2.1.0"3208 resolved "https://registry.yarnpkg.com/readdirp/-/readdirp-2.1.0.tgz#4ed0ad060df3073300c48440373f72d1cc642d78"3209 dependencies:3210 graceful-fs "^4.1.2"3211 minimatch "^3.0.2"3212 readable-stream "^2.0.2"3213 set-immediate-shim "^1.0.1"32143215realpath-native@^1.0.0:3216 version "1.0.0"3217 resolved "https://registry.yarnpkg.com/realpath-native/-/realpath-native-1.0.0.tgz#7885721a83b43bd5327609f0ddecb2482305fdf0"3218 dependencies:
2 unmodified lines
3221regenerate@^1.2.1:3222 version "1.3.3"3223 resolved "https://registry.yarnpkg.com/regenerate/-/regenerate-1.3.3.tgz#0c336d3980553d755c39b586ae3b20aa49c82b7f"32243225regenerator-runtime@^0.10.5:3226 version "0.10.5"3227 resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.10.5.tgz#336c3efc1220adcedda2c9fab67b5a7955a33658"32283229regenerator-runtime@^0.11.0, regenerator-runtime@^0.11.1:3230 version "0.11.1"3231 resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz#be05ad7f9bf7d22e056f9726cee5017fbf19e2e9"3232
181 unmodified lines
3414set-blocking@^2.0.0, set-blocking@~2.0.0:3415 version "2.0.0"3416 resolved "https://registry.yarnpkg.com/set-blocking/-/set-blocking-2.0.0.tgz#045f9782d011ae9a6803ddd382b24392b3d890f7"34173418set-immediate-shim@^1.0.1:3419 version "1.0.1"3420 resolved "https://registry.yarnpkg.com/set-immediate-shim/-/set-immediate-shim-1.0.1.tgz#4b2b1b27eb808a9f8dcc481a58e5e56f599f3f61"34213422sha.js@^2.4.0, sha.js@^2.4.8, sha.js@~2.4.4:3423 version "2.4.9"3424 resolved "https://registry.yarnpkg.com/sha.js/-/sha.js-2.4.9.tgz#98f64880474b74f4a38b8da9d3c0f2d104633e7d"3425 dependencies:
387 unmodified lines
3813 dependencies:3814 punycode "1.3.2"3815 querystring "0.2.0"38163817user-home@^1.1.1:3818 version "1.1.1"3819 resolved "https://registry.yarnpkg.com/user-home/-/user-home-1.1.1.tgz#2b5be23a32b63a7c9deb8d0f28d485724a3df190"38203821util-deprecate@~1.0.1:3822 version "1.0.2"3823 resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf"3824
13 unmodified lines
3838uuid@^3.0.0, uuid@^3.1.0:3839 version "3.1.0"3840 resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.1.0.tgz#3dd3d3e790abc24d7b0d3a034ffababe28ebbc04"38413842v8flags@^2.1.1:3843 version "2.1.1"3844 resolved "https://registry.yarnpkg.com/v8flags/-/v8flags-2.1.1.tgz#aab1a1fa30d45f88dd321148875ac02c0b55e5b4"3845 dependencies:3846 user-home "^1.1.1"38473848validate-npm-package-license@^3.0.1:3849 version "3.0.1"3850 resolved "https://registry.yarnpkg.com/validate-npm-package-license/-/validate-npm-package-license-3.0.1.tgz#2804babe712ad3379459acfbe24746ab2c303fbc"3851 dependencies:
159 unmodified lines