reactish-state 0.11.0 → 0.11.1

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.
package/README.md CHANGED
@@ -2,6 +2,19 @@
2
2
 
3
3
  > Simple, decentralized(atomic) state management for React.
4
4
 
5
+ ## ✨Highlights✨
6
+
7
+ - Decentralized state management
8
+ - Un-opinionated and easy-to-use API
9
+ - No need of wrapping app in Context or prop drilling
10
+ - React components re-render only on changes
11
+ - Compatible with React 18 concurrent rendering
12
+ - Selectors are memoized by default
13
+ - Feature extensible with middleware or plugins
14
+ - States persistable to browser storage
15
+ - Support Redux dev tools via middleware
16
+ - [~1KB](https://bundlephobia.com/package/reactish-state): simple and small
17
+
5
18
  ## Install
6
19
 
7
20
  `npm install reactish-state` or `yarn add reactish-state`
@@ -142,19 +155,6 @@ The difference might sound insignificant, but imaging every single state update
142
155
  - No need to use a React Hook to extract actions from the store.
143
156
  - Actions come from outside React and no need to add them into the `useCallback/useEffect` dep array.
144
157
 
145
- ## ✨Highlights✨
146
-
147
- - Decentralized state management
148
- - Un-opinionated and easy-to-use API
149
- - No need of wrapping app in Context or prop drilling
150
- - React components re-render only on changes
151
- - Compatible with React 18 concurrent rendering
152
- - Selectors are memoized by default
153
- - Feature extensible with middleware or plugins
154
- - States persistable to browser storage
155
- - Support Redux dev tools via middleware
156
- - [~1KB](https://bundlephobia.com/package/reactish-state): simple and small
157
-
158
158
  # Recipes
159
159
 
160
160
  ## States should be updated immutably
package/dist/cjs/index.js CHANGED
@@ -70,7 +70,7 @@ const createSelector = ({
70
70
  },
71
71
  subscribe: createSubscriber(items)
72
72
  };
73
- plugin == null ? void 0 : plugin(selector, config);
73
+ plugin == null || plugin(selector, config);
74
74
  return selector;
75
75
  };
76
76
  const selector = /*#__PURE__*/createSelector();
@@ -24,7 +24,7 @@ const createSelector = ({
24
24
  },
25
25
  subscribe: createSubscriber(items)
26
26
  };
27
- plugin == null ? void 0 : plugin(selector, config);
27
+ plugin == null || plugin(selector, config);
28
28
  return selector;
29
29
  };
30
30
  const selector = /*#__PURE__*/createSelector();
@@ -2,9 +2,10 @@
2
2
 
3
3
  const applyMiddleware = (middlewares, {
4
4
  fromRight
5
- } = {}) => (api, config) => middlewares[fromRight ? 'reduceRight' : 'reduce']((set, middleware) => middleware ? middleware(Object.assign({}, api, {
5
+ } = {}) => (api, config) => middlewares[fromRight ? 'reduceRight' : 'reduce']((set, middleware) => middleware ? middleware({
6
+ ...api,
6
7
  set
7
- }), config) : set, api.set);
8
+ }, config) : set, api.set);
8
9
 
9
10
  const persist = ({
10
11
  prefix,
@@ -1,7 +1,8 @@
1
1
  const applyMiddleware = (middlewares, {
2
2
  fromRight
3
- } = {}) => (api, config) => middlewares[fromRight ? 'reduceRight' : 'reduce']((set, middleware) => middleware ? middleware(Object.assign({}, api, {
3
+ } = {}) => (api, config) => middlewares[fromRight ? 'reduceRight' : 'reduce']((set, middleware) => middleware ? middleware({
4
+ ...api,
4
5
  set
5
- }), config) : set, api.set);
6
+ }, config) : set, api.set);
6
7
 
7
8
  export { applyMiddleware };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "reactish-state",
3
- "version": "0.11.0",
3
+ "version": "0.11.1",
4
4
  "description": "Simple, decentralized state management for React.",
5
5
  "author": "Zheng Song",
6
6
  "license": "MIT",
@@ -27,13 +27,13 @@
27
27
  "bundle": "rollup -c",
28
28
  "watch": "rollup -c -w",
29
29
  "clean": "rm -Rf dist types",
30
- "post-build": "rm -Rf types/__tests__",
31
30
  "types": "tsc",
31
+ "posttypes": "rm -Rf types/__tests__",
32
32
  "lint": "eslint .",
33
33
  "lint:fix": "eslint --fix .",
34
34
  "pret": "prettier -c .",
35
35
  "pret:fix": "prettier -w .",
36
- "build": "run-s pret clean lint types bundle post-build",
36
+ "build": "run-s pret clean lint types bundle",
37
37
  "test": "jest",
38
38
  "test:watch": "jest --watch",
39
39
  "eg": "npm run dev --prefix examples"
@@ -73,35 +73,35 @@
73
73
  "use-sync-external-store": "^1.2.0"
74
74
  },
75
75
  "devDependencies": {
76
- "@babel/core": "^7.21.4",
77
- "@babel/preset-env": "^7.21.4",
78
- "@babel/preset-react": "^7.18.6",
79
- "@babel/preset-typescript": "^7.21.4",
76
+ "@babel/core": "^7.23.2",
77
+ "@babel/preset-env": "^7.23.2",
78
+ "@babel/preset-react": "^7.22.15",
79
+ "@babel/preset-typescript": "^7.23.2",
80
80
  "@redux-devtools/extension": "^3.2.5",
81
- "@rollup/plugin-babel": "^6.0.3",
82
- "@rollup/plugin-node-resolve": "^15.0.2",
83
- "@testing-library/jest-dom": "^5.16.5",
81
+ "@rollup/plugin-babel": "^6.0.4",
82
+ "@rollup/plugin-node-resolve": "^15.2.3",
83
+ "@testing-library/jest-dom": "^6.1.4",
84
84
  "@testing-library/react": "^14.0.0",
85
- "@types/jest": "^29.5.0",
86
- "@types/react": "^18.0.34",
87
- "@types/use-sync-external-store": "^0.0.3",
88
- "@typescript-eslint/eslint-plugin": "^5.58.0",
89
- "@typescript-eslint/parser": "^5.58.0",
85
+ "@types/jest": "^29.5.7",
86
+ "@types/react": "^18.2.34",
87
+ "@types/use-sync-external-store": "^0.0.5",
88
+ "@typescript-eslint/eslint-plugin": "^6.9.1",
89
+ "@typescript-eslint/parser": "^6.9.1",
90
90
  "babel-plugin-pure-annotations": "^0.1.2",
91
- "eslint": "^8.38.0",
92
- "eslint-config-prettier": "^8.8.0",
93
- "eslint-plugin-jest": "^27.2.1",
94
- "eslint-plugin-react": "^7.32.2",
91
+ "eslint": "^8.53.0",
92
+ "eslint-config-prettier": "^9.0.0",
93
+ "eslint-plugin-jest": "^27.6.0",
94
+ "eslint-plugin-react": "^7.33.2",
95
95
  "eslint-plugin-react-hooks": "^4.6.0",
96
96
  "eslint-plugin-react-hooks-addons": "^0.3.1",
97
- "immer": "^9.0.21",
98
- "jest": "^29.5.0",
99
- "jest-environment-jsdom": "^29.5.0",
97
+ "immer": "^10.0.3",
98
+ "jest": "^29.7.0",
99
+ "jest-environment-jsdom": "^29.7.0",
100
100
  "npm-run-all": "^4.1.5",
101
- "prettier": "^2.8.7",
101
+ "prettier": "^3.0.3",
102
102
  "react": "^18.2.0",
103
103
  "react-dom": "^18.2.0",
104
- "rollup": "^3.20.2",
105
- "typescript": "^5.0.4"
104
+ "rollup": "^4.3.0",
105
+ "typescript": "^5.2.2"
106
106
  }
107
107
  }