Skip to content

Commit

Permalink
New build set. Current stats
Browse files Browse the repository at this point in the history
Import size report for immer:
┌───────────────────────┬───────────┬────────────┬───────────┐
│        (index)        │ just this │ cumulative │ increment │
├───────────────────────┼───────────┼────────────┼───────────┤
│ import * from 'immer' │   6761    │     0      │     0     │
│        produce        │   4048    │    4048    │     0     │
│       enableES5       │   4908    │    4916    │    868    │
│     enableMapSet      │   5007    │    5769    │    853    │
│     enablePatches     │   4836    │    6544    │    775    │
└───────────────────────┴───────────┴────────────┴───────────┘
(this report was generated by npmjs.com/package/import-size)
  • Loading branch information
mweststrate committed Feb 16, 2020
1 parent 4c4fecc commit 9aec0fe
Show file tree
Hide file tree
Showing 31 changed files with 3,290 additions and 273 deletions.
38 changes: 18 additions & 20 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
// Note; this config requires node 8.4 or higher
"type": "node",
"protocol": "auto",
"request": "launch",
"name": "debug unit test",
"stopOnEntry": false,
"program": "${workspaceRoot}/node_modules/jest-cli/bin/jest.js",
"args": ["--verbose", "--testRegex",".*", "-i", "${file}"],
"runtimeArgs": [
"--nolazy"
]
}
]
}
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
// Note; this config requires node 8.4 or higher
"type": "node",
"protocol": "auto",
"request": "launch",
"name": "debug unit test",
"stopOnEntry": false,
"program": "${workspaceRoot}/node_modules/jest-cli/bin/jest.js",
"args": ["--verbose", "-i", "${file}"],
"runtimeArgs": ["--nolazy"]
}
]
}
4 changes: 3 additions & 1 deletion .watchmanconfig
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
{}
{
"ignore_dirs": ["node_modules", "_site", "dist", "coverage"]
}
11 changes: 10 additions & 1 deletion __tests__/base.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,21 @@
"use strict"
import {Immer, nothing, original, isDraft, immerable} from "../src/index"
import {
Immer,
nothing,
original,
isDraft,
immerable,
enableAllPlugins
} from "../src/immer"
import {each, shallowCopy, isEnumerable, DRAFT_STATE} from "../src/internal"
import deepFreeze from "deep-freeze"
import cloneDeep from "lodash.clonedeep"
import * as lodash from "lodash"

jest.setTimeout(1000)

enableAllPlugins()

test("immer should have no dependencies", () => {
expect(require("../package.json").dependencies).toBeUndefined()
})
Expand Down
8 changes: 7 additions & 1 deletion __tests__/curry.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
"use strict"
import produce, {setUseProxies, produceWithPatches} from "../src/index"
import produce, {
setUseProxies,
produceWithPatches,
enableAllPlugins
} from "../src/immer"

enableAllPlugins()

runTests("proxy", true)
runTests("es5", false)
Expand Down
9 changes: 8 additions & 1 deletion __tests__/draft.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
import {assert, _} from "spec.ts"
import produce, {Draft, castDraft, original} from "../src/index"
import produce, {
Draft,
castDraft,
original,
enableAllPlugins
} from "../src/immer"

enableAllPlugins()

// For checking if a type is assignable to its draft type (and vice versa)
const toDraft: <T>(value: T) => Draft<T> = x => x as any
Expand Down
9 changes: 8 additions & 1 deletion __tests__/empty.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
import {produce, produceWithPatches, setUseProxies} from "../src"
import {
produce,
produceWithPatches,
setUseProxies,
enableAllPlugins
} from "../src/immer"
import {DRAFT_STATE} from "../src/internal"

enableAllPlugins()

test("empty stub test", () => {
expect(true).toBe(true)
})
Expand Down
17 changes: 15 additions & 2 deletions __tests__/frozen.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
"use strict"
import produce, {setUseProxies, setAutoFreeze} from "../src/index"
import produce, {
setUseProxies,
setAutoFreeze,
enableAllPlugins
} from "../src/immer"

enableAllPlugins()

const {isFrozen} = Object

Expand Down Expand Up @@ -178,7 +184,14 @@ function runTests(name, useProxies) {
it("Map#get() of frozen object will became draftable", () => {
const base = {
map: new Map([
["a", new Map([["a", true], ["b", true], ["c", true]])],
[
"a",
new Map([
["a", true],
["b", true],
["c", true]
])
],
["b", new Map([["a", true]])],
["c", new Map([["a", true]])]
])
Expand Down
4 changes: 3 additions & 1 deletion __tests__/hooks.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
"use strict"
import {Immer, setUseProxies} from "../src/index"
import {Immer, setUseProxies, enableAllPlugins} from "../src/immer"
import matchers from "expect/build/matchers"
import {isSet} from "../src/common"

enableAllPlugins()

describe("hooks (proxy) -", () => createHookTests(true))
describe("hooks (es5) -", () => createHookTests(false))

Expand Down
4 changes: 3 additions & 1 deletion __tests__/immutable.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import {assert, _} from "spec.ts"
import produce, {Immutable, castImmutable} from "../src/index"
import produce, {Immutable, castImmutable, enableAllPlugins} from "../src/immer"

enableAllPlugins()

test("types are ok", () => {
// array in tuple
Expand Down
7 changes: 5 additions & 2 deletions __tests__/manual.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@ import {
createDraft,
finishDraft,
produce,
isDraft
} from "../src/index"
isDraft,
enableAllPlugins
} from "../src/immer"

enableAllPlugins()

runTests("proxy", true)
runTests("es5", false)
Expand Down
124 changes: 78 additions & 46 deletions __tests__/map-set.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
"use strict"
import {Immer, nothing, original, isDraft, immerable} from "../src/index"
import {
Immer,
nothing,
original,
isDraft,
immerable,
enableAllPlugins
} from "../src/immer"
import {each, shallowCopy, isEnumerable, DRAFT_STATE} from "../src/common"

enableAllPlugins()

jest.setTimeout(1000)

runBaseTest("proxy (no freeze)", true, false)
Expand Down Expand Up @@ -75,7 +84,14 @@ function runBaseTest(name, useProxies, autoFreeze, useListener) {
test("#466 - mapChangeBug ", () => {
const obj = {
map: new Map([
["a", new Map([["b", true], ["c", true], ["d", true]])],
[
"a",
new Map([
["b", true],
["c", true],
["d", true]
])
],
["b", new Map([["a", true]])],
["c", new Map([["a", true]])],
["d", new Map([["a", true]])]
Expand All @@ -91,7 +107,14 @@ function runBaseTest(name, useProxies, autoFreeze, useListener) {
expect(result).toEqual([
{
map: new Map([
["a", new Map([["b", true], ["c", true], ["d", true]])],
[
"a",
new Map([
["b", true],
["c", true],
["d", true]
])
],
["b", new Map()],
["c", new Map()],
["d", new Map()]
Expand Down Expand Up @@ -134,7 +157,14 @@ function runBaseTest(name, useProxies, autoFreeze, useListener) {
test("#466 - mapChangeBug2 ", () => {
const obj = {
map: new Map([
["a", new Map([["b", true], ["c", true], ["d", true]])],
[
"a",
new Map([
["b", true],
["c", true],
["d", true]
])
],
["b", new Map([["a", true]])],
["c", new Map([["a", true]])],
["d", new Map([["a", true]])]
Expand All @@ -148,50 +178,52 @@ function runBaseTest(name, useProxies, autoFreeze, useListener) {
otherMap.delete("a")
})
})
expect(result).toEqual(
expect(result).toEqual({
map: new Map([
[
"a",
new Map([
["b", true],
["c", true],
["d", true]
])
],
["b", new Map([])],
["c", new Map([])],
["d", new Map([])]
])
})
expect(p).toEqual([
{
map: new Map([
["a", new Map([["b", true], ["c", true], ["d", true]])],
["b", new Map([])],
["c", new Map([])],
["d", new Map([])]
])
op: "remove",
path: ["map", "b", "a"]
},
{
op: "remove",
path: ["map", "c", "a"]
},
{
op: "remove",
path: ["map", "d", "a"]
}
)
expect(p).toEqual(
[
{
op: "remove",
path: ["map", "b", "a"]
},
{
op: "remove",
path: ["map", "c", "a"]
},
{
op: "remove",
path: ["map", "d", "a"]
}
])
expect(ip).toEqual(
[
{
op: "add",
path: ["map", "b", "a"],
value: true
},
{
op: "add",
path: ["map", "c", "a"],
value: true
},
{
op: "add",
path: ["map", "d", "a"],
value: true
}
]
)
])
expect(ip).toEqual([
{
op: "add",
path: ["map", "b", "a"],
value: true
},
{
op: "add",
path: ["map", "c", "a"],
value: true
},
{
op: "add",
path: ["map", "d", "a"],
value: true
}
])
})
})
}
2 changes: 1 addition & 1 deletion __tests__/null.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"use strict"
import produce from "../src/index"
import produce from "../src/immer"

describe("null functionality", () => {
const baseState = null
Expand Down
4 changes: 3 additions & 1 deletion __tests__/original.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
"use strict"
import produce, {original, setUseProxies} from "../src/index"
import produce, {original, setUseProxies, enableAllPlugins} from "../src/immer"

enableAllPlugins()

describe("original", () => {
const baseState = {
Expand Down
7 changes: 5 additions & 2 deletions __tests__/patch.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@
import produce, {
setUseProxies,
applyPatches,
produceWithPatches
} from "../src/index"
produceWithPatches,
enableAllPlugins
} from "../src/immer"

enableAllPlugins()

jest.setTimeout(1000)

Expand Down
Loading

0 comments on commit 9aec0fe

Please sign in to comment.