use-memo-map 0.0.4-main.cb50367 → 0.0.4-main.d85f41c
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/lib/esmodules-types/index.d.ts +2 -0
- package/lib/esmodules-types/private/usePrevious.d.ts +1 -0
- package/lib/esmodules-types/useMemoMap.d.ts +15 -0
- package/package.json +42 -37
- /package/lib/{types → commonjs-types}/index.d.ts +0 -0
- /package/lib/{types → commonjs-types}/private/usePrevious.d.ts +0 -0
- /package/lib/{types → commonjs-types}/useMemoMap.d.ts +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function usePrevious<T>(value: T, initialValue?: T): T | undefined;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
type UseMemoMapOptions<T> = {
|
|
2
|
+
itemEquality?: (this: readonly T[], x: T, y: T) => boolean;
|
|
3
|
+
};
|
|
4
|
+
/**
|
|
5
|
+
* Creates a memoized mapping function.
|
|
6
|
+
*
|
|
7
|
+
* Unlike `React.useMemo`, the mapping function can be called multiple times in a single render loop.
|
|
8
|
+
* All calls to the mapping function will be memoized.
|
|
9
|
+
*
|
|
10
|
+
* The memoized arguments and return values will survive next render.
|
|
11
|
+
*
|
|
12
|
+
* When the mapping function change, all memoized values will be invalidated.
|
|
13
|
+
*/
|
|
14
|
+
export default function useMemoMap<T = unknown, R = unknown>(mapper: (this: readonly T[], item: T, index: -1, array: readonly T[]) => R, { itemEquality }?: UseMemoMapOptions<T>): (array: readonly T[]) => readonly R[];
|
|
15
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,41 +1,54 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "use-memo-map",
|
|
3
|
-
"version": "0.0.4-main.
|
|
3
|
+
"version": "0.0.4-main.d85f41c",
|
|
4
4
|
"description": "Memoizes calls to array map function similar to React.useMemo. Memoized results will survive next render.",
|
|
5
5
|
"files": [
|
|
6
|
-
"./lib
|
|
6
|
+
"./lib/"
|
|
7
7
|
],
|
|
8
8
|
"exports": {
|
|
9
9
|
".": {
|
|
10
|
-
"import":
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
"import": {
|
|
11
|
+
"types": "./lib/esmodules-types/index.d.ts",
|
|
12
|
+
"default": "./lib/esmodules/index.js"
|
|
13
|
+
},
|
|
14
|
+
"require": {
|
|
15
|
+
"types": "./lib/commonjs-types/index.d.ts",
|
|
16
|
+
"default": "./lib/commonjs/index.js"
|
|
17
|
+
}
|
|
13
18
|
},
|
|
14
19
|
"./useMemoMap": {
|
|
15
|
-
"import":
|
|
16
|
-
|
|
17
|
-
|
|
20
|
+
"import": {
|
|
21
|
+
"types": "./lib/esmodules-types/useMemoMap.d.ts",
|
|
22
|
+
"default": "./lib/esmodules/useMemoMap.js"
|
|
23
|
+
},
|
|
24
|
+
"require": {
|
|
25
|
+
"types": "./lib/commonjs-types/useMemoMap.d.ts",
|
|
26
|
+
"default": "./lib/commonjs/useMemoMap.js"
|
|
27
|
+
}
|
|
18
28
|
}
|
|
19
29
|
},
|
|
20
30
|
"main": "./lib/commonjs/index.js",
|
|
21
|
-
"typings": "./lib/types/index.d.ts",
|
|
31
|
+
"typings": "./lib/commonjs-types/index.d.ts",
|
|
22
32
|
"scripts": {
|
|
23
|
-
"build": "npm run build:babel && npm run build:typescript",
|
|
24
|
-
"build:babel": "npm run build:babel:commonjs && npm run build:babel:esmodules",
|
|
33
|
+
"build": "npm run build:babel:commonjs && npm run build:babel:esmodules && npm run build:typescript:commonjs && npm run build:typescript:esmodules",
|
|
25
34
|
"build:babel:commonjs": "babel src --config-file ./babel.commonjs.config.json --extensions .ts,.tsx --out-dir ./lib/commonjs/",
|
|
26
35
|
"build:babel:esmodules": "babel src --config-file ./babel.esmodules.config.json --extensions .ts,.tsx --out-dir ./lib/esmodules/",
|
|
27
|
-
"build:typescript": "tsc --project ./src/tsconfig.declaration.json",
|
|
36
|
+
"build:typescript:commonjs": "tsc --project ./src/tsconfig.declaration.commonjs.json",
|
|
37
|
+
"build:typescript:esmodules": "tsc --project ./src/tsconfig.declaration.esmodules.json",
|
|
28
38
|
"bump": "npm run bump:prod && npm run bump:dev && npm run bump:auditfix && npm run bump:babel",
|
|
29
39
|
"bump:auditfix": "npm audit fix || exit 0",
|
|
30
40
|
"bump:babel": "npm run bump:babel:commonjs && npm run bump:babel:esmodules",
|
|
31
|
-
"bump:babel:commonjs": "cat babel.commonjs.config.json | jq --arg CORE_JS_VERSION `cat node_modules/@babel/runtime-corejs3/package.json | jq -r .version` '(.plugins[] | select(.[0] == \"@babel/plugin-transform-runtime\"))[1].version = $CORE_JS_VERSION' | prettier --parser json > babel.commonjs.config.json.tmp && mv babel.commonjs.config.json.tmp babel.commonjs.config.json",
|
|
32
|
-
"bump:babel:esmodules": "cat babel.esmodules.config.json | jq --arg CORE_JS_VERSION `cat node_modules/@babel/runtime-corejs3/package.json | jq -r .version` '(.plugins[] | select(.[0] == \"@babel/plugin-transform-runtime\"))[1].version = $CORE_JS_VERSION' | prettier --parser json > babel.esmodules.config.json.tmp && mv babel.esmodules.config.json.tmp babel.esmodules.config.json",
|
|
33
|
-
"bump:dev": "
|
|
34
|
-
"bump:prod": "
|
|
35
|
-
"
|
|
36
|
-
"
|
|
37
|
-
"precommit": "eslint ./src/",
|
|
41
|
+
"bump:babel:commonjs": "cat babel.commonjs.config.json | jq --arg CORE_JS_VERSION `[ -f node_modules/@babel/runtime-corejs3/package.json ] && cat node_modules/@babel/runtime-corejs3/package.json | jq -r .version || cat ../../node_modules/@babel/runtime-corejs3/package.json | jq -r .version` '(.plugins[] | select(.[0] == \"@babel/plugin-transform-runtime\"))[1].version = $CORE_JS_VERSION' | prettier --parser json > babel.commonjs.config.json.tmp && mv babel.commonjs.config.json.tmp babel.commonjs.config.json",
|
|
42
|
+
"bump:babel:esmodules": "cat babel.esmodules.config.json | jq --arg CORE_JS_VERSION `[ -f node_modules/@babel/runtime-corejs3/package.json ] && cat node_modules/@babel/runtime-corejs3/package.json | jq -r .version || cat ../../node_modules/@babel/runtime-corejs3/package.json | jq -r .version` '(.plugins[] | select(.[0] == \"@babel/plugin-transform-runtime\"))[1].version = $CORE_JS_VERSION' | prettier --parser json > babel.esmodules.config.json.tmp && mv babel.esmodules.config.json.tmp babel.esmodules.config.json",
|
|
43
|
+
"bump:dev": "PACKAGES_TO_BUMP=$(cat package.json | jq -r '.localPeerDependencies // {} as $L | .devDependencies // {} | to_entries | map(select(.key as $K | $L | has($K) | not)) | map(.key + \"@latest\") | join(\" \")') && [ ! -z \"$PACKAGES_TO_BUMP\" ] && npm install $PACKAGES_TO_BUMP || true",
|
|
44
|
+
"bump:prod": "PACKAGES_TO_BUMP=$(cat package.json | jq -r '.localPeerDependencies // {} as $L | .dependencies // {} | to_entries | map(select(.key as $K | $L | has($K) | not)) | map(.key + \"@latest\") | join(\" \")') && [ ! -z \"$PACKAGES_TO_BUMP\" ] && npm install $PACKAGES_TO_BUMP || true",
|
|
45
|
+
"postscaffold": "npm run bump:babel",
|
|
46
|
+
"precommit": "npm run precommit:eslint && npm run precommit:typescript:production && npm run precommit:typescript:test",
|
|
47
|
+
"precommit:eslint": "eslint ./src/",
|
|
48
|
+
"precommit:typescript:production": "tsc --noEmit --project ./src/tsconfig.precommit.production.json",
|
|
49
|
+
"precommit:typescript:test": "tsc --noEmit --project ./src/tsconfig.precommit.test.json",
|
|
38
50
|
"prepack": "cp ../../CHANGELOG.md . && cp ../../LICENSE . && cp ../../README.md .",
|
|
51
|
+
"start": "esbuild --bundle --outfile=./public/main.js --servedir=./public --sourcemap ./scenarios/index.jsx",
|
|
39
52
|
"test": "jest"
|
|
40
53
|
},
|
|
41
54
|
"repository": {
|
|
@@ -54,32 +67,23 @@
|
|
|
54
67
|
"url": "https://github.com/compulim/use-memo-map/issues"
|
|
55
68
|
},
|
|
56
69
|
"homepage": "https://github.com/compulim/use-memo-map#readme",
|
|
57
|
-
"pinDependencies": {
|
|
58
|
-
"@types/react": [
|
|
59
|
-
"17",
|
|
60
|
-
"@testing-library/react-hooks@8.0.1 does not support react@>=18"
|
|
61
|
-
],
|
|
62
|
-
"react": [
|
|
63
|
-
"17",
|
|
64
|
-
"@testing-library/react-hooks@8.0.1 does not support react@>=18"
|
|
65
|
-
],
|
|
66
|
-
"react-test-renderer": [
|
|
67
|
-
"17",
|
|
68
|
-
"@testing-library/react-hooks@8.0.1 does not support react@>=18"
|
|
69
|
-
]
|
|
70
|
-
},
|
|
70
|
+
"pinDependencies": {},
|
|
71
71
|
"devDependencies": {
|
|
72
72
|
"@babel/cli": "^7.22.9",
|
|
73
73
|
"@babel/core": "^7.22.9",
|
|
74
74
|
"@babel/plugin-transform-runtime": "^7.22.9",
|
|
75
75
|
"@babel/preset-env": "^7.22.9",
|
|
76
|
+
"@babel/preset-react": "^7.22.15",
|
|
76
77
|
"@babel/preset-typescript": "^7.22.5",
|
|
77
|
-
"@testing-library/react
|
|
78
|
-
"@
|
|
78
|
+
"@testing-library/react": "^14.0.0",
|
|
79
|
+
"@tsconfig/recommended": "^1.0.2",
|
|
80
|
+
"@tsconfig/strictest": "^2.0.2",
|
|
81
|
+
"@types/jest": "^29.5.4",
|
|
82
|
+
"@types/react": "^18.2.21",
|
|
79
83
|
"jest": "^29.6.1",
|
|
80
84
|
"jest-environment-jsdom": "^29.6.1",
|
|
81
|
-
"react": "^
|
|
82
|
-
"react-
|
|
85
|
+
"react": "^18.2.0",
|
|
86
|
+
"react-dom": "^18.2.0",
|
|
83
87
|
"typescript": "^5.1.6"
|
|
84
88
|
},
|
|
85
89
|
"peerDependencies": {
|
|
@@ -87,6 +91,7 @@
|
|
|
87
91
|
},
|
|
88
92
|
"dependencies": {
|
|
89
93
|
"@babel/runtime-corejs3": "7.22.6",
|
|
94
|
+
"use-memo-map": "^0.0.4-main.d85f41c",
|
|
90
95
|
"use-ref-from": "0.0.2"
|
|
91
96
|
}
|
|
92
97
|
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|