react-native-global-state-hooks 15.0.2 → 16.0.3-beta.0

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.
Files changed (48) hide show
  1. package/GlobalStore.cjs +5 -0
  2. package/GlobalStore.d.ts +3 -3
  3. package/GlobalStore.js +5 -1
  4. package/GlobalStore.mjs +5 -0
  5. package/README.md +1209 -202
  6. package/actions.cjs +1 -0
  7. package/actions.d.ts +1 -0
  8. package/actions.js +1 -0
  9. package/actions.mjs +1 -0
  10. package/asyncStorageWrapper.cjs +4 -0
  11. package/asyncStorageWrapper.js +4 -1
  12. package/asyncStorageWrapper.mjs +4 -0
  13. package/bundle.cjs +1 -0
  14. package/bundle.js +1 -1
  15. package/bundle.mjs +1 -0
  16. package/createContext.cjs +1 -0
  17. package/createContext.js +1 -1
  18. package/createContext.mjs +1 -0
  19. package/createGlobalState.cjs +1 -0
  20. package/createGlobalState.d.ts +8 -8
  21. package/createGlobalState.js +1 -1
  22. package/createGlobalState.mjs +1 -0
  23. package/index.d.ts +11 -10
  24. package/isPromise.cjs +1 -0
  25. package/isPromise.js +1 -0
  26. package/isPromise.mjs +1 -0
  27. package/isRecord.cjs +1 -0
  28. package/isRecord.js +1 -1
  29. package/isRecord.mjs +1 -0
  30. package/package.json +48 -90
  31. package/shallowCompare.cjs +1 -0
  32. package/shallowCompare.js +1 -1
  33. package/shallowCompare.mjs +1 -0
  34. package/throwWrongKeyOnActionCollectionConfig.cjs +1 -0
  35. package/throwWrongKeyOnActionCollectionConfig.js +1 -1
  36. package/throwWrongKeyOnActionCollectionConfig.mjs +1 -0
  37. package/tryCatch.cjs +1 -0
  38. package/tryCatch.js +1 -0
  39. package/tryCatch.mjs +1 -0
  40. package/types.cjs +1 -0
  41. package/types.d.ts +15 -4
  42. package/types.js +1 -1
  43. package/types.mjs +0 -0
  44. package/uniqueId.cjs +1 -0
  45. package/uniqueId.d.ts +1 -1
  46. package/uniqueId.js +1 -1
  47. package/uniqueId.mjs +1 -0
  48. package/webpack.config.js +0 -132
package/webpack.config.js DELETED
@@ -1,132 +0,0 @@
1
- /* eslint-disable no-undef */
2
- /* eslint-disable @typescript-eslint/no-require-imports */
3
- const path = require("path");
4
- const TerserPlugin = require("terser-webpack-plugin");
5
-
6
- const individualEntries = {
7
- // inherit from react-global-state-hooks
8
- createContext: "./src/createContext.ts",
9
- GlobalStore: "./src/GlobalStore.ts",
10
- createGlobalState: "./src/createGlobalState.ts",
11
- types: "./src/types.ts",
12
- isRecord: "./src/isRecord.ts",
13
- shallowCompare: "./src/shallowCompare.ts",
14
- throwWrongKeyOnActionCollectionConfig: "./src/throwWrongKeyOnActionCollectionConfig.ts",
15
- uniqueId: "./src/uniqueId.ts",
16
-
17
- // extras
18
- asyncStorageWrapper: "./src/asyncStorageWrapper.ts",
19
- };
20
-
21
- const generateExternalEntryMappings = () => {
22
- const keys = Object.keys(individualEntries);
23
- const fromEntries = keys.reduce((acc, key) => {
24
- acc[`./${key}`] = `./${key}.js`;
25
- return acc;
26
- }, {});
27
-
28
- const fromBasePackage = keys.reduce((acc, key) => {
29
- acc[`react-hooks-global-states/${key}`] = `react-hooks-global-states/${key}`;
30
- return acc;
31
- }, {});
32
-
33
- return {
34
- ...fromEntries,
35
- ...fromBasePackage,
36
- };
37
- };
38
-
39
- module.exports = {
40
- mode: "production",
41
- entry: {
42
- bundle: "./src/index.ts",
43
- ...individualEntries,
44
- },
45
- externals: {
46
- react: "react",
47
- "react-native": "react-native",
48
- "@react-native-async-storage/async-storage": "@react-native-async-storage/async-storage",
49
-
50
- // avoid bundle the base package
51
- "json-storage-formatter": "json-storage-formatter",
52
- "json-storage-formatter/clone": "json-storage-formatter/clone",
53
- "json-storage-formatter/isNil": "json-storage-formatter/isNil",
54
- "json-storage-formatter/isNumber": "json-storage-formatter/isNumber",
55
- "json-storage-formatter/isBoolean": "json-storage-formatter/isBoolean",
56
- "json-storage-formatter/isString": "json-storage-formatter/isString",
57
- "json-storage-formatter/isDate": "json-storage-formatter/isDate",
58
- "json-storage-formatter/isRegex": "json-storage-formatter/isRegex",
59
- "json-storage-formatter/isFunction": "json-storage-formatter/isFunction",
60
- "json-storage-formatter/isPrimitive": "json-storage-formatter/isPrimitive",
61
- "json-storage-formatter/types": "json-storage-formatter/types",
62
- "json-storage-formatter/formatFromStore": "json-storage-formatter/formatFromStore",
63
- "json-storage-formatter/formatToStore": "json-storage-formatter/formatToStore",
64
-
65
- "react-hooks-global-states": "react-hooks-global-states",
66
-
67
- ...generateExternalEntryMappings(),
68
- },
69
- output: {
70
- path: path.resolve(__dirname),
71
- filename: ({ chunk: { name } }) => {
72
- return `${name}.js`;
73
- },
74
- libraryTarget: "umd",
75
- library: "react-native-global-state-hooks",
76
- globalObject: "this",
77
- },
78
- resolve: {
79
- extensions: [".ts", ".js"],
80
- },
81
- module: {
82
- rules: [
83
- {
84
- test: /\.ts$/,
85
- use: [
86
- {
87
- loader: "babel-loader",
88
- options: {
89
- presets: ["@babel/preset-env", "@babel/preset-react", "@babel/preset-typescript"],
90
- plugins: [
91
- "@babel/plugin-transform-modules-commonjs",
92
- "@babel/plugin-proposal-export-namespace-from",
93
- ],
94
- },
95
- },
96
- {
97
- loader: "ts-loader",
98
- },
99
- ],
100
- exclude: /node_modules/,
101
- },
102
- ],
103
- },
104
- optimization: {
105
- minimize: true,
106
- minimizer: [
107
- new TerserPlugin({
108
- extractComments: false,
109
- terserOptions: {
110
- compress: {
111
- passes: 5,
112
- drop_console: true,
113
- drop_debugger: true,
114
- keep_fargs: false,
115
- keep_infinity: true,
116
- reduce_funcs: true,
117
- reduce_vars: true,
118
- keep_fnames: false,
119
- toplevel: true,
120
- },
121
- mangle: {
122
- toplevel: true,
123
- properties: false,
124
- },
125
- format: {
126
- comments: false,
127
- },
128
- },
129
- }),
130
- ],
131
- },
132
- };