mobx-state-tree 7.0.0 → 7.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -9,8 +9,6 @@ export type ModelPrimitive = string | number | boolean | Date;
|
|
|
9
9
|
export interface ModelPropertiesDeclaration {
|
|
10
10
|
[key: string]: ModelPrimitive | IAnyType;
|
|
11
11
|
}
|
|
12
|
-
/** intersect two object types, but omit keys of B from A before doing so */
|
|
13
|
-
type OmitMerge<A, B> = Omit<A, keyof B> & B;
|
|
14
12
|
/**
|
|
15
13
|
* Unmaps syntax property declarations to a map of { propName: IType }
|
|
16
14
|
*
|
|
@@ -34,7 +32,6 @@ export type ModelPropertiesDeclarationToProperties<T extends ModelPropertiesDecl
|
|
|
34
32
|
* - unknown = true
|
|
35
33
|
*/
|
|
36
34
|
type IsOptionalValue<C, TV, FV> = undefined extends C ? TV : FV;
|
|
37
|
-
type AnyObject = Record<string, any>;
|
|
38
35
|
/**
|
|
39
36
|
* Name of the properties of an object that can't be set to undefined, any or unknown
|
|
40
37
|
* @hidden
|
|
@@ -84,15 +81,15 @@ export interface ModelActions {
|
|
|
84
81
|
export interface IModelType<PROPS extends ModelProperties, OTHERS, CustomC = _NotCustomized, CustomS = _NotCustomized> extends IType<ModelCreationType2<PROPS, CustomC>, ModelSnapshotType2<PROPS, CustomS>, ModelInstanceType<PROPS, OTHERS>> {
|
|
85
82
|
readonly properties: PROPS;
|
|
86
83
|
named(newName: string): IModelType<PROPS, OTHERS, CustomC, CustomS>;
|
|
87
|
-
props<PROPS2 extends ModelPropertiesDeclaration>(props: PROPS2): IModelType<
|
|
88
|
-
views<V extends
|
|
89
|
-
actions<A extends ModelActions>(fn: (self: Instance<this>) => A): IModelType<PROPS,
|
|
90
|
-
volatile<
|
|
91
|
-
extend<A extends ModelActions = {}, V extends
|
|
84
|
+
props<PROPS2 extends ModelPropertiesDeclaration>(props: PROPS2): IModelType<PROPS & ModelPropertiesDeclarationToProperties<PROPS2>, OTHERS, CustomC, CustomS>;
|
|
85
|
+
views<V extends Object>(fn: (self: Instance<this>) => V): IModelType<PROPS, OTHERS & V, CustomC, CustomS>;
|
|
86
|
+
actions<A extends ModelActions>(fn: (self: Instance<this>) => A): IModelType<PROPS, OTHERS & A, CustomC, CustomS>;
|
|
87
|
+
volatile<TP extends object>(fn: (self: Instance<this>) => TP): IModelType<PROPS, OTHERS & TP, CustomC, CustomS>;
|
|
88
|
+
extend<A extends ModelActions = {}, V extends Object = {}, VS extends Object = {}>(fn: (self: Instance<this>) => {
|
|
92
89
|
actions?: A;
|
|
93
90
|
views?: V;
|
|
94
91
|
state?: VS;
|
|
95
|
-
}): IModelType<PROPS,
|
|
92
|
+
}): IModelType<PROPS, OTHERS & A & V & VS, CustomC, CustomS>;
|
|
96
93
|
preProcessSnapshot<NewC = ModelCreationType2<PROPS, CustomC>>(fn: (snapshot: NewC) => WithAdditionalProperties<ModelCreationType2<PROPS, CustomC>>): IModelType<PROPS, OTHERS, NewC, CustomS>;
|
|
97
94
|
postProcessSnapshot<NewS = ModelSnapshotType2<PROPS, CustomS>>(fn: (snapshot: ModelSnapshotType2<PROPS, CustomS>) => NewS): IModelType<PROPS, OTHERS, CustomC, NewS>;
|
|
98
95
|
}
|
package/package.json
CHANGED
|
@@ -1,112 +1,116 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
2
|
+
"name": "mobx-state-tree",
|
|
3
|
+
"version": "7.0.2",
|
|
4
|
+
"description": "Opinionated, transactional, MobX powered state container",
|
|
5
|
+
"main": "dist/mobx-state-tree.js",
|
|
6
|
+
"umd:main": "dist/mobx-state-tree.umd.js",
|
|
7
|
+
"module": "dist/mobx-state-tree.module.js",
|
|
8
|
+
"browser": {
|
|
9
|
+
"./dist/mobx-state-tree.js": "./dist/mobx-state-tree.js",
|
|
10
|
+
"./dist/mobx-state-tree.module.js": "./dist/mobx-state-tree.module.js"
|
|
11
|
+
},
|
|
12
|
+
"unpkg": "dist/mobx-state-tree.umd.min.js",
|
|
13
|
+
"jsnext:main": "dist/mobx-state-tree.module.js",
|
|
14
|
+
"react-native": "dist/mobx-state-tree.module.js",
|
|
15
|
+
"typings": "dist/index.d.ts",
|
|
16
|
+
"sideEffects": false,
|
|
17
|
+
"scripts": {
|
|
18
|
+
"clean": "shx rm -rf dist lib",
|
|
19
|
+
"build": "bun run clean && tsc && cpr lib/src dist --filter=\\.js$ && rollup -c",
|
|
20
|
+
"test:dev": "NODE_ENV=development bun test",
|
|
21
|
+
"test:prod": "MST_TESTING=1 NODE_ENV=production bun test",
|
|
22
|
+
"test:all": "bun run test:dev && bun run test:prod && bun run size",
|
|
23
|
+
"test:perf": "bun test ./__tests__/perf/",
|
|
24
|
+
"test:perf:compiled": "bun run build && bun run jest:perf && TS_NODE_COMPILER_OPTIONS='{\"module\": \"commonjs\"}' /usr/bin/time node --expose-gc --require ts-node/register __tests__/perf/report.ts",
|
|
25
|
+
"typecheck": "tsc --noEmit",
|
|
26
|
+
"size": "size-limit",
|
|
27
|
+
"tag-new-version": "yarn version && git push --tags",
|
|
28
|
+
"build-docs": "bun run fix-typedoc && shx rm -rf ./docs/API && typedoc --options ./typedocconfig.js",
|
|
29
|
+
"publish-docs": "bun run build-docs && cd ./website && GIT_USER=jamonholmgren USE_SSH=true bun run publish-gh-pages",
|
|
30
|
+
"start": "cd website && bun run start",
|
|
31
|
+
"prepare": "husky install",
|
|
32
|
+
"lint": "tslint -c ./tslint.json 'src/**/*.ts'",
|
|
33
|
+
"fix-typedoc": "shx rm -rf ./node_modules/typedoc/node_modules/typescript",
|
|
34
|
+
"prettier:list": "prettier --list-different \"src/**/*.ts\" \"__tests__/**/*.ts\"",
|
|
35
|
+
"prettier:check": "prettier --check \"src/**/*.ts\" \"__tests__/**/*.ts\"",
|
|
36
|
+
"prettier:write": "prettier --write \"src/**/*.ts\" \"__tests__/**/*.ts\""
|
|
37
|
+
},
|
|
38
|
+
"lint-staged": {
|
|
39
|
+
"*.{ts,tsx,js,jsx}": [
|
|
40
|
+
"prettier --write"
|
|
41
|
+
]
|
|
42
|
+
},
|
|
43
|
+
"repository": {
|
|
44
|
+
"type": "git",
|
|
45
|
+
"url": "https://github.com/mobxjs/mobx-state-tree.git"
|
|
46
|
+
},
|
|
47
|
+
"author": "Michel Weststrate",
|
|
48
|
+
"license": "MIT",
|
|
49
|
+
"bugs": {
|
|
50
|
+
"url": "https://github.com/mobxjs/mobx-state-tree/issues"
|
|
51
|
+
},
|
|
52
|
+
"files": [
|
|
53
|
+
"dist/"
|
|
54
|
+
],
|
|
55
|
+
"dependencies": {
|
|
56
|
+
"ts-essentials": "^9.4.1"
|
|
57
|
+
},
|
|
58
|
+
"devDependencies": {
|
|
59
|
+
"@size-limit/preset-big-lib": "^5.0.3",
|
|
60
|
+
"@types/bun": "^1.0.6",
|
|
61
|
+
"@types/node": "^12.0.2",
|
|
62
|
+
"concat": "^1.0.3",
|
|
63
|
+
"coveralls": "^3.1.0",
|
|
64
|
+
"cpr": "^3.0.1",
|
|
65
|
+
"husky": "^7.0.0",
|
|
66
|
+
"lint-staged": "^11.1.2",
|
|
67
|
+
"mobx": "^6.13.1",
|
|
68
|
+
"prettier": "3.4.1",
|
|
69
|
+
"rollup": "^2.18.1",
|
|
70
|
+
"rollup-plugin-commonjs": "^10.0.0",
|
|
71
|
+
"rollup-plugin-filesize": "^9.0.1",
|
|
72
|
+
"rollup-plugin-node-resolve": "^5.0.0",
|
|
73
|
+
"rollup-plugin-replace": "^2.1.0",
|
|
74
|
+
"rollup-plugin-terser": "^6.1.0",
|
|
75
|
+
"shx": "^0.3.2",
|
|
76
|
+
"size-limit": "^5.0.3",
|
|
77
|
+
"ts-node": "^8.10.2",
|
|
78
|
+
"tslib": "^2.0.0",
|
|
79
|
+
"tslint": "^6.1.3",
|
|
80
|
+
"tslint-config-prettier": "^1.18.0",
|
|
81
|
+
"typedoc": "0.15.8",
|
|
82
|
+
"typedoc-plugin-markdown": "2.2.11",
|
|
83
|
+
"typescript": "^5.3.3",
|
|
84
|
+
"yarn-deduplicate": "^3.1.0"
|
|
85
|
+
},
|
|
86
|
+
"peerDependencies": {
|
|
87
|
+
"mobx": "^6.3.0"
|
|
88
|
+
},
|
|
89
|
+
"keywords": [
|
|
90
|
+
"mobx",
|
|
91
|
+
"mobx-state-tree",
|
|
92
|
+
"promise",
|
|
93
|
+
"reactive",
|
|
94
|
+
"frp",
|
|
95
|
+
"functional-reactive-programming",
|
|
96
|
+
"state management"
|
|
97
|
+
],
|
|
98
|
+
"gitHead": "27ec7ac0b0743a367fb01a7f40192f3042bd91f2",
|
|
99
|
+
"prettier": {
|
|
100
|
+
"printWidth": 100,
|
|
101
|
+
"semi": false,
|
|
102
|
+
"tabWidth": 4,
|
|
103
|
+
"singleQuote": false,
|
|
104
|
+
"trailingComma": "none",
|
|
105
|
+
"arrowParens": "avoid",
|
|
106
|
+
"useTabs": false
|
|
107
|
+
},
|
|
108
|
+
"size-limit": [
|
|
109
|
+
{
|
|
110
|
+
"path": "./dist/mobx-state-tree.min.js",
|
|
111
|
+
"limit": "25 KB",
|
|
112
|
+
"webpack": false,
|
|
113
|
+
"running": false
|
|
114
|
+
}
|
|
41
115
|
]
|
|
42
|
-
},
|
|
43
|
-
"repository": {
|
|
44
|
-
"type": "git",
|
|
45
|
-
"url": "https://github.com/mobxjs/mobx-state-tree.git"
|
|
46
|
-
},
|
|
47
|
-
"author": "Michel Weststrate",
|
|
48
|
-
"license": "MIT",
|
|
49
|
-
"bugs": {
|
|
50
|
-
"url": "https://github.com/mobxjs/mobx-state-tree/issues"
|
|
51
|
-
},
|
|
52
|
-
"files": [
|
|
53
|
-
"dist/"
|
|
54
|
-
],
|
|
55
|
-
"devDependencies": {
|
|
56
|
-
"@size-limit/preset-big-lib": "^5.0.3",
|
|
57
|
-
"@types/bun": "^1.0.6",
|
|
58
|
-
"@types/node": "^12.0.2",
|
|
59
|
-
"concat": "^1.0.3",
|
|
60
|
-
"coveralls": "^3.1.0",
|
|
61
|
-
"cpr": "^3.0.1",
|
|
62
|
-
"husky": "^7.0.0",
|
|
63
|
-
"lint-staged": "^11.1.2",
|
|
64
|
-
"mobx": "^6.13.1",
|
|
65
|
-
"prettier": "^2.4.1",
|
|
66
|
-
"rollup": "^2.18.1",
|
|
67
|
-
"rollup-plugin-commonjs": "^10.0.0",
|
|
68
|
-
"rollup-plugin-filesize": "^9.0.1",
|
|
69
|
-
"rollup-plugin-node-resolve": "^5.0.0",
|
|
70
|
-
"rollup-plugin-replace": "^2.1.0",
|
|
71
|
-
"rollup-plugin-terser": "^6.1.0",
|
|
72
|
-
"shx": "^0.3.2",
|
|
73
|
-
"size-limit": "^5.0.3",
|
|
74
|
-
"ts-essentials": "^9.4.1",
|
|
75
|
-
"ts-node": "^8.10.2",
|
|
76
|
-
"tslib": "^2.0.0",
|
|
77
|
-
"tslint": "^6.1.3",
|
|
78
|
-
"tslint-config-prettier": "^1.18.0",
|
|
79
|
-
"typedoc": "0.15.8",
|
|
80
|
-
"typedoc-plugin-markdown": "2.2.11",
|
|
81
|
-
"typescript": "^5.3.3",
|
|
82
|
-
"yarn-deduplicate": "^3.1.0"
|
|
83
|
-
},
|
|
84
|
-
"peerDependencies": {
|
|
85
|
-
"mobx": "^6.3.0"
|
|
86
|
-
},
|
|
87
|
-
"keywords": [
|
|
88
|
-
"mobx",
|
|
89
|
-
"mobx-state-tree",
|
|
90
|
-
"promise",
|
|
91
|
-
"reactive",
|
|
92
|
-
"frp",
|
|
93
|
-
"functional-reactive-programming",
|
|
94
|
-
"state management"
|
|
95
|
-
],
|
|
96
|
-
"gitHead": "27ec7ac0b0743a367fb01a7f40192f3042bd91f2",
|
|
97
|
-
"prettier": {
|
|
98
|
-
"printWidth": 100,
|
|
99
|
-
"tabWidth": 2,
|
|
100
|
-
"singleQuote": false,
|
|
101
|
-
"trailingComma": "none",
|
|
102
|
-
"semi": false
|
|
103
|
-
},
|
|
104
|
-
"size-limit": [
|
|
105
|
-
{
|
|
106
|
-
"path": "./dist/mobx-state-tree.min.js",
|
|
107
|
-
"limit": "25 KB",
|
|
108
|
-
"webpack": false,
|
|
109
|
-
"running": false
|
|
110
|
-
}
|
|
111
|
-
]
|
|
112
116
|
}
|