react-global-state-hooks 8.0.17 → 8.0.18
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/getLocalStorageItem.js +1 -1
- package/package.json +4 -4
- package/setLocalStorageItem.js +1 -1
- package/webpack.config.js +59 -58
package/getLocalStorageItem.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(
|
|
1
|
+
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("json-storage-formatter/formatFromStore")):"function"==typeof define&&define.amd?define(["json-storage-formatter/formatFromStore"],e):"object"==typeof exports?exports["react-global-state-hooks"]=e(require("json-storage-formatter/formatFromStore")):t["react-global-state-hooks"]=e(t["json-storage-formatter/formatFromStore"])}(this,(t=>(()=>{"use strict";var e={164:(t,e,r)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getLocalStorageItem=void 0;var o=r(89);e.getLocalStorageItem=function(t){var e=t.key;if(!e)return null;var r="function"==typeof e?e():e,a=localStorage.getItem(r);if(null===a)return null;var n=t.decrypt||t.encrypt?"function"==typeof t.decrypt?t.decrypt(a):atob(a):a;return(0,o.formatFromStore)(n,{jsonParse:!0})},e.default=e.getLocalStorageItem},89:e=>{e.exports=t}},r={};var o=function t(o){var a=r[o];if(void 0!==a)return a.exports;var n=r[o]={exports:{}};return e[o](n,n.exports,t),n.exports}(164);return o})()));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-global-state-hooks",
|
|
3
|
-
"version": "8.0.
|
|
3
|
+
"version": "8.0.18",
|
|
4
4
|
"description": "This is a package to easily handling global-state across your react components No-redux, No-context.",
|
|
5
5
|
"main": "./bundle.js",
|
|
6
6
|
"types": "./index.d.ts",
|
|
@@ -172,10 +172,10 @@
|
|
|
172
172
|
"webpack-cli": "^5.0.1"
|
|
173
173
|
},
|
|
174
174
|
"peerDependencies": {
|
|
175
|
-
"
|
|
176
|
-
"
|
|
175
|
+
"react": ">=17.0.0",
|
|
176
|
+
"json-storage-formatter": "^2.0.9"
|
|
177
177
|
},
|
|
178
178
|
"dependencies": {
|
|
179
|
-
"react-hooks-global-states": "^7.0.
|
|
179
|
+
"react-hooks-global-states": "^7.0.17"
|
|
180
180
|
}
|
|
181
181
|
}
|
package/setLocalStorageItem.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e
|
|
1
|
+
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("json-storage-formatter/formatToStore")):"function"==typeof define&&define.amd?define(["json-storage-formatter/formatToStore"],e):"object"==typeof exports?exports["react-global-state-hooks"]=e(require("json-storage-formatter/formatToStore")):t["react-global-state-hooks"]=e(t["json-storage-formatter/formatToStore"])}(this,(t=>(()=>{"use strict";var e={826:(t,e,o)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.setLocalStorageItem=void 0;var r=o(888);e.setLocalStorageItem=function(t,e){var o=e.key;if(o){var a="function"==typeof o?o():o,s=(0,r.formatToStore)(t,{stringify:!0,excludeTypes:["function"]}),f=e.encrypt?"function"==typeof e.encrypt?e.encrypt(s):btoa(s):s;localStorage.setItem(a,f)}},e.default=e.setLocalStorageItem},888:e=>{e.exports=t}},o={};var r=function t(r){var a=o[r];if(void 0!==a)return a.exports;var s=o[r]={exports:{}};return e[r](s,s.exports,t),s.exports}(826);return r})()));
|
package/webpack.config.js
CHANGED
|
@@ -1,67 +1,74 @@
|
|
|
1
1
|
const path = require('path');
|
|
2
2
|
const TerserPlugin = require('terser-webpack-plugin');
|
|
3
3
|
|
|
4
|
+
const individualEntries = {
|
|
5
|
+
// inherit from react-global-state-hooks
|
|
6
|
+
createContext: './src/createContext.ts',
|
|
7
|
+
GlobalStore: './src/GlobalStore.ts',
|
|
8
|
+
GlobalStoreAbstract: './src/GlobalStoreAbstract.ts',
|
|
9
|
+
createCustomGlobalState: './src/createCustomGlobalState.ts',
|
|
10
|
+
createGlobalState: './src/createGlobalState.ts',
|
|
11
|
+
types: './src/types.ts',
|
|
12
|
+
debounce: './src/debounce.ts',
|
|
13
|
+
isRecord: './src/isRecord.ts',
|
|
14
|
+
shallowCompare: './src/shallowCompare.ts',
|
|
15
|
+
throwWrongKeyOnActionCollectionConfig: './src/throwWrongKeyOnActionCollectionConfig.ts',
|
|
16
|
+
uniqueId: './src/uniqueId.ts',
|
|
17
|
+
uniqueSymbol: './src/uniqueSymbol.ts',
|
|
18
|
+
useStableState: './src/useStableState.ts',
|
|
19
|
+
generateStackHash: './src/generateStackHash.ts',
|
|
20
|
+
|
|
21
|
+
// extras
|
|
22
|
+
getLocalStorageItem: './src/getLocalStorageItem.ts',
|
|
23
|
+
setLocalStorageItem: './src/setLocalStorageItem.ts',
|
|
24
|
+
generateStackHash: './src/generateStackHash.ts',
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
const getExternalsForEntries = () => {
|
|
28
|
+
const keys = Object.keys(individualEntries);
|
|
29
|
+
const fromEntries = keys.reduce((acc, key) => {
|
|
30
|
+
acc[`./${key}`] = `./${key}.js`;
|
|
31
|
+
return acc;
|
|
32
|
+
}, {});
|
|
33
|
+
|
|
34
|
+
const fromBasePackage = keys.reduce((acc, key) => {
|
|
35
|
+
acc[`react-hooks-global-states/${key}`] = `react-hooks-global-states/${key}`;
|
|
36
|
+
return acc;
|
|
37
|
+
}, {});
|
|
38
|
+
|
|
39
|
+
return {
|
|
40
|
+
...fromEntries,
|
|
41
|
+
...fromBasePackage,
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
|
|
4
45
|
module.exports = {
|
|
5
46
|
mode: 'production',
|
|
6
47
|
entry: {
|
|
7
48
|
// inherit from react-global-state-hooks
|
|
8
49
|
bundle: './src/index.ts',
|
|
9
|
-
|
|
10
|
-
GlobalStore: './src/GlobalStore.ts',
|
|
11
|
-
GlobalStoreAbstract: './src/GlobalStoreAbstract.ts',
|
|
12
|
-
createCustomGlobalState: './src/createCustomGlobalState.ts',
|
|
13
|
-
createGlobalState: './src/createGlobalState.ts',
|
|
14
|
-
types: './src/types.ts',
|
|
15
|
-
debounce: './src/debounce.ts',
|
|
16
|
-
isRecord: './src/isRecord.ts',
|
|
17
|
-
shallowCompare: './src/shallowCompare.ts',
|
|
18
|
-
throwWrongKeyOnActionCollectionConfig: './src/throwWrongKeyOnActionCollectionConfig.ts',
|
|
19
|
-
uniqueId: './src/uniqueId.ts',
|
|
20
|
-
uniqueSymbol: './src/uniqueSymbol.ts',
|
|
21
|
-
useStableState: './src/useStableState.ts',
|
|
22
|
-
// extras
|
|
23
|
-
getLocalStorageItem: './src/getLocalStorageItem.ts',
|
|
24
|
-
setLocalStorageItem: './src/setLocalStorageItem.ts',
|
|
25
|
-
generateStackHash: './src/generateStackHash.ts',
|
|
50
|
+
...individualEntries,
|
|
26
51
|
},
|
|
27
52
|
externals: {
|
|
28
53
|
react: 'react',
|
|
29
|
-
// avoid bundle the base package
|
|
30
|
-
'react-hooks-global-states/createContext': 'react-hooks-global-states/createContext',
|
|
31
|
-
'react-hooks-global-states/GlobalStore': 'react-hooks-global-states/GlobalStore',
|
|
32
|
-
'react-hooks-global-states/GlobalStoreAbstract': 'react-hooks-global-states/GlobalStoreAbstract',
|
|
33
|
-
'react-hooks-global-states/createCustomGlobalState': 'react-hooks-global-states/createCustomGlobalState',
|
|
34
|
-
'react-hooks-global-states/createGlobalState': 'react-hooks-global-states/createGlobalState',
|
|
35
|
-
'react-hooks-global-states/types': 'react-hooks-global-states/types',
|
|
36
|
-
'react-hooks-global-states/debounce': 'react-hooks-global-states/debounce',
|
|
37
|
-
'react-hooks-global-states/isRecord': 'react-hooks-global-states/isRecord',
|
|
38
|
-
'react-hooks-global-states/shallowCompare': 'react-hooks-global-states/shallowCompare',
|
|
39
|
-
'react-hooks-global-states/throwWrongKeyOnActionCollectionConfig':
|
|
40
|
-
'react-hooks-global-states/throwWrongKeyOnActionCollectionConfig',
|
|
41
|
-
'react-hooks-global-states/uniqueId': 'react-hooks-global-states/uniqueId',
|
|
42
|
-
'react-hooks-global-states/uniqueSymbol': 'react-hooks-global-states/uniqueSymbol',
|
|
43
|
-
'react-hooks-global-states/useStableState': 'react-hooks-global-states/useStableState',
|
|
44
|
-
'react-hooks-global-states/generateStackHash': 'react-hooks-global-states/generateStackHash',
|
|
45
54
|
|
|
46
|
-
|
|
47
|
-
'
|
|
48
|
-
'
|
|
49
|
-
'
|
|
50
|
-
'
|
|
51
|
-
'
|
|
52
|
-
'
|
|
53
|
-
'
|
|
54
|
-
'
|
|
55
|
-
'
|
|
56
|
-
'
|
|
57
|
-
'
|
|
58
|
-
'
|
|
59
|
-
|
|
60
|
-
'
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
'./setLocalStorageItem': './setLocalStorageItem.js',
|
|
64
|
-
'./generateStackHash': './generateStackHash.js',
|
|
55
|
+
'json-storage-formatter': 'json-storage-formatter',
|
|
56
|
+
'json-storage-formatter/clone': 'json-storage-formatter/clone',
|
|
57
|
+
'json-storage-formatter/isNil': 'json-storage-formatter/isNil',
|
|
58
|
+
'json-storage-formatter/isNumber': 'json-storage-formatter/isNumber',
|
|
59
|
+
'json-storage-formatter/isBoolean': 'json-storage-formatter/isBoolean',
|
|
60
|
+
'json-storage-formatter/isString': 'json-storage-formatter/isString',
|
|
61
|
+
'json-storage-formatter/isDate': 'json-storage-formatter/isDate',
|
|
62
|
+
'json-storage-formatter/isRegex': 'json-storage-formatter/isRegex',
|
|
63
|
+
'json-storage-formatter/isFunction': 'json-storage-formatter/isFunction',
|
|
64
|
+
'json-storage-formatter/isPrimitive': 'json-storage-formatter/isPrimitive',
|
|
65
|
+
'json-storage-formatter/types': 'json-storage-formatter/types',
|
|
66
|
+
'json-storage-formatter/formatFromStore': 'json-storage-formatter/formatFromStore',
|
|
67
|
+
'json-storage-formatter/formatToStore': 'json-storage-formatter/formatToStore',
|
|
68
|
+
|
|
69
|
+
'react-hooks-global-states': 'react-hooks-global-states',
|
|
70
|
+
|
|
71
|
+
...getExternalsForEntries(),
|
|
65
72
|
},
|
|
66
73
|
output: {
|
|
67
74
|
path: path.resolve(__dirname),
|
|
@@ -74,12 +81,6 @@ module.exports = {
|
|
|
74
81
|
},
|
|
75
82
|
resolve: {
|
|
76
83
|
extensions: ['.ts', '.js'],
|
|
77
|
-
alias: {
|
|
78
|
-
'react-global-state-hooks': path.resolve(
|
|
79
|
-
__dirname,
|
|
80
|
-
'node_modules/react-global-state-hooks/package.json'
|
|
81
|
-
),
|
|
82
|
-
},
|
|
83
84
|
},
|
|
84
85
|
module: {
|
|
85
86
|
rules: [
|