koatty_cacheable 1.6.0 → 1.6.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/.rollup.config.js +59 -59
- package/CHANGELOG.md +39 -37
- package/LICENSE +29 -29
- package/README.md +188 -57
- package/dist/LICENSE +29 -29
- package/dist/README.md +188 -57
- package/dist/index.d.ts +12 -1
- package/dist/index.js +117 -71
- package/dist/index.mjs +116 -72
- package/dist/package.json +99 -98
- package/package.json +99 -98
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* @Author: richen
|
|
3
|
-
* @Date:
|
|
3
|
+
* @Date: 2025-06-09 13:04:37
|
|
4
4
|
* @License: BSD (3-Clause)
|
|
5
5
|
* @Copyright (c) - <richenlin(at)gmail.com>
|
|
6
6
|
* @HomePage: https://koatty.org/
|
|
@@ -20,6 +20,88 @@ import { CacheStore } from 'koatty_store';
|
|
|
20
20
|
* @License: BSD (3-Clause)
|
|
21
21
|
* @Copyright (c): <richenlin(at)gmail.com>
|
|
22
22
|
*/
|
|
23
|
+
const longKey = 128;
|
|
24
|
+
/**
|
|
25
|
+
* Extract parameter names from function signature
|
|
26
|
+
* @param func The function to extract parameters from
|
|
27
|
+
* @returns Array of parameter names
|
|
28
|
+
*/
|
|
29
|
+
function getArgs(func) {
|
|
30
|
+
try {
|
|
31
|
+
// Match function parameters in parentheses
|
|
32
|
+
const args = func.toString().match(/.*?\(([^)]*)\)/);
|
|
33
|
+
if (args && args.length > 1) {
|
|
34
|
+
// Split parameters into array and clean them
|
|
35
|
+
return args[1].split(",").map(function (a) {
|
|
36
|
+
// Remove inline comments and whitespace
|
|
37
|
+
return a.replace(/\/\*.*\*\//, "").trim();
|
|
38
|
+
}).filter(function (ae) {
|
|
39
|
+
// Filter out empty strings
|
|
40
|
+
return ae;
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
return [];
|
|
44
|
+
}
|
|
45
|
+
catch (error) {
|
|
46
|
+
// Return empty array if parsing fails
|
|
47
|
+
return [];
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Get parameter indexes based on parameter names
|
|
52
|
+
* @param funcParams Function parameter names
|
|
53
|
+
* @param params Target parameter names to find indexes for
|
|
54
|
+
* @returns Array of parameter indexes (-1 if not found)
|
|
55
|
+
*/
|
|
56
|
+
function getParamIndex(funcParams, params) {
|
|
57
|
+
return params.map(param => funcParams.indexOf(param));
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Generate cache key based on cache name and parameters
|
|
61
|
+
* @param cacheName base cache name
|
|
62
|
+
* @param paramIndexes parameter indexes
|
|
63
|
+
* @param paramNames parameter names
|
|
64
|
+
* @param props method arguments
|
|
65
|
+
* @returns generated cache key
|
|
66
|
+
*/
|
|
67
|
+
function generateCacheKey(cacheName, paramIndexes, paramNames, props) {
|
|
68
|
+
let key = cacheName;
|
|
69
|
+
for (let i = 0; i < paramIndexes.length; i++) {
|
|
70
|
+
const paramIndex = paramIndexes[i];
|
|
71
|
+
if (paramIndex >= 0 && props[paramIndex] !== undefined) {
|
|
72
|
+
key += `:${paramNames[i]}:${Helper.toString(props[paramIndex])}`;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
return key.length > longKey ? Helper.murmurHash(key) : key;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Create a delay promise
|
|
79
|
+
* @param ms Delay time in milliseconds
|
|
80
|
+
* @returns Promise that resolves after the specified delay
|
|
81
|
+
*/
|
|
82
|
+
function delay(ms) {
|
|
83
|
+
return new Promise(resolve => setTimeout(resolve, ms));
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Execute a function after a specified delay
|
|
87
|
+
* @param fn Function to execute
|
|
88
|
+
* @param ms Delay time in milliseconds
|
|
89
|
+
* @returns Promise that resolves with the function result
|
|
90
|
+
*/
|
|
91
|
+
async function asyncDelayedExecution(fn, ms) {
|
|
92
|
+
await delay(ms);
|
|
93
|
+
return fn();
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/*
|
|
97
|
+
* @Description:
|
|
98
|
+
* @Usage:
|
|
99
|
+
* @Author: richen
|
|
100
|
+
* @Date: 2024-11-07 16:00:02
|
|
101
|
+
* @LastEditTime: 2024-11-07 16:00:05
|
|
102
|
+
* @License: BSD (3-Clause)
|
|
103
|
+
* @Copyright (c): <richenlin(at)gmail.com>
|
|
104
|
+
*/
|
|
23
105
|
// storeCache
|
|
24
106
|
const storeCache = {
|
|
25
107
|
store: null
|
|
@@ -67,52 +149,26 @@ async function InitCacheStore() {
|
|
|
67
149
|
});
|
|
68
150
|
}
|
|
69
151
|
/**
|
|
70
|
-
*
|
|
71
|
-
* @param {*} func
|
|
72
|
-
* @return {*}
|
|
152
|
+
* Close cache store connection for cleanup (mainly for testing)
|
|
73
153
|
*/
|
|
74
|
-
function
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
154
|
+
async function CloseCacheStore() {
|
|
155
|
+
if (storeCache.store && storeCache.store.client) {
|
|
156
|
+
try {
|
|
157
|
+
const client = storeCache.store.client;
|
|
158
|
+
if (typeof client.quit === 'function') {
|
|
159
|
+
await client.quit();
|
|
160
|
+
}
|
|
161
|
+
else if (typeof client.close === 'function') {
|
|
162
|
+
await client.close();
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
catch {
|
|
166
|
+
// Ignore cleanup errors
|
|
167
|
+
}
|
|
168
|
+
finally {
|
|
169
|
+
storeCache.store = null;
|
|
170
|
+
}
|
|
86
171
|
}
|
|
87
|
-
return [];
|
|
88
|
-
}
|
|
89
|
-
/**
|
|
90
|
-
* @description:
|
|
91
|
-
* @param {string[]} funcParams
|
|
92
|
-
* @param {string[]} params
|
|
93
|
-
* @return {*}
|
|
94
|
-
*/
|
|
95
|
-
function getParamIndex(funcParams, params) {
|
|
96
|
-
return params.map(param => funcParams.indexOf(param));
|
|
97
|
-
}
|
|
98
|
-
/**
|
|
99
|
-
*
|
|
100
|
-
* @param ms
|
|
101
|
-
* @returns
|
|
102
|
-
*/
|
|
103
|
-
function delay(ms) {
|
|
104
|
-
return new Promise(resolve => setTimeout(resolve, ms));
|
|
105
|
-
}
|
|
106
|
-
/**
|
|
107
|
-
* async delayed execution func
|
|
108
|
-
* @param fn
|
|
109
|
-
* @param ms
|
|
110
|
-
* @returns
|
|
111
|
-
*/
|
|
112
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
113
|
-
async function asyncDelayedExecution(fn, ms) {
|
|
114
|
-
await delay(ms); // delay ms second
|
|
115
|
-
return fn();
|
|
116
172
|
}
|
|
117
173
|
|
|
118
174
|
/*
|
|
@@ -122,7 +178,6 @@ async function asyncDelayedExecution(fn, ms) {
|
|
|
122
178
|
* @Description:
|
|
123
179
|
* @Copyright (c) - <richenlin(at)gmail.com>
|
|
124
180
|
*/
|
|
125
|
-
const longKey = 128;
|
|
126
181
|
/**
|
|
127
182
|
* Decorate this method to support caching.
|
|
128
183
|
* The cache method returns a value to ensure that the next time
|
|
@@ -155,24 +210,18 @@ function CacheAble(cacheName, opt = {
|
|
|
155
210
|
// Get the parameter list of the method
|
|
156
211
|
const funcParams = getArgs(target[methodName]);
|
|
157
212
|
// Get the defined parameter location
|
|
158
|
-
const paramIndexes = getParamIndex(funcParams,
|
|
213
|
+
const paramIndexes = getParamIndex(funcParams, mergedOpt.params || []);
|
|
159
214
|
descriptor = {
|
|
160
215
|
configurable,
|
|
161
216
|
enumerable,
|
|
162
217
|
writable: true,
|
|
163
218
|
async value(...props) {
|
|
164
219
|
const store = await GetCacheStore(this.app).catch((e) => {
|
|
165
|
-
DefaultLogger.
|
|
220
|
+
DefaultLogger.error("Get cache store instance failed." + e.message);
|
|
166
221
|
return null;
|
|
167
222
|
});
|
|
168
223
|
if (store) {
|
|
169
|
-
|
|
170
|
-
for (const item of paramIndexes) {
|
|
171
|
-
if (props[item] !== undefined) {
|
|
172
|
-
key += `:${mergedOpt.params[item]}:${Helper.toString(props[item])}`;
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
key = key.length > longKey ? Helper.murmurHash(key) : key;
|
|
224
|
+
const key = generateCacheKey(cacheName, paramIndexes, mergedOpt.params, props);
|
|
176
225
|
const res = await store.get(key).catch((e) => {
|
|
177
226
|
DefaultLogger.error("Cache get error:" + e.message);
|
|
178
227
|
});
|
|
@@ -226,40 +275,35 @@ function CacheEvict(cacheName, opt = {
|
|
|
226
275
|
// Get the parameter list of the method
|
|
227
276
|
const funcParams = getArgs(target[methodName]);
|
|
228
277
|
// Get the defined parameter location
|
|
229
|
-
const paramIndexes = getParamIndex(funcParams, opt.params);
|
|
278
|
+
const paramIndexes = getParamIndex(funcParams, opt.params || []);
|
|
230
279
|
descriptor = {
|
|
231
280
|
configurable,
|
|
232
281
|
enumerable,
|
|
233
282
|
writable: true,
|
|
234
283
|
async value(...props) {
|
|
235
284
|
const store = await GetCacheStore(this.app).catch((e) => {
|
|
236
|
-
DefaultLogger.
|
|
285
|
+
DefaultLogger.error("Get cache store instance failed." + e.message);
|
|
237
286
|
return null;
|
|
238
287
|
});
|
|
239
288
|
if (store) {
|
|
240
|
-
|
|
241
|
-
for (const item of paramIndexes) {
|
|
242
|
-
if (props[item] !== undefined) {
|
|
243
|
-
key += `:${opt.params[item]}:${Helper.toString(props[item])}`;
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
key = key.length > longKey ? Helper.murmurHash(key) : key;
|
|
289
|
+
const key = generateCacheKey(cacheName, paramIndexes, opt.params || [], props);
|
|
247
290
|
const result = await value.apply(this, props);
|
|
248
291
|
store.del(key).catch((e) => {
|
|
249
|
-
DefaultLogger.
|
|
292
|
+
DefaultLogger.error("Cache delete error:" + e.message);
|
|
250
293
|
});
|
|
251
294
|
if (opt.delayedDoubleDeletion) {
|
|
295
|
+
const delayTime = 5000;
|
|
252
296
|
asyncDelayedExecution(() => {
|
|
253
297
|
store.del(key).catch((e) => {
|
|
254
298
|
DefaultLogger.error("Cache double delete error:" + e.message);
|
|
255
299
|
});
|
|
256
|
-
},
|
|
257
|
-
return result;
|
|
258
|
-
}
|
|
259
|
-
else {
|
|
260
|
-
// tslint:disable-next-line: no-invalid-this
|
|
261
|
-
return value.apply(this, props);
|
|
300
|
+
}, delayTime);
|
|
262
301
|
}
|
|
302
|
+
return result;
|
|
303
|
+
}
|
|
304
|
+
else {
|
|
305
|
+
// If store is not available, execute method directly
|
|
306
|
+
return value.apply(this, props);
|
|
263
307
|
}
|
|
264
308
|
}
|
|
265
309
|
};
|
|
@@ -269,4 +313,4 @@ function CacheEvict(cacheName, opt = {
|
|
|
269
313
|
};
|
|
270
314
|
}
|
|
271
315
|
|
|
272
|
-
export { CacheAble, CacheEvict, GetCacheStore };
|
|
316
|
+
export { CacheAble, CacheEvict, CloseCacheStore, GetCacheStore, InitCacheStore };
|
package/dist/package.json
CHANGED
|
@@ -1,98 +1,99 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "koatty_cacheable",
|
|
3
|
-
"version": "1.6.
|
|
4
|
-
"description": "Cacheable for koatty.",
|
|
5
|
-
"scripts": {
|
|
6
|
-
"build": "npm run build:js && npm run build:dts && npm run build:doc && npm run build:cp",
|
|
7
|
-
"build:cp": "node scripts/postBuild && npx copyfiles package.json LICENSE README.md dist/",
|
|
8
|
-
"build:js": "npx rollup --bundleConfigAsCjs -c .rollup.config.js",
|
|
9
|
-
"build:doc": "npx api-documenter markdown --input temp --output docs/api",
|
|
10
|
-
"build:dts": "npx tsc && npx api-extractor run --local --verbose",
|
|
11
|
-
"eslint": "eslint --ext .ts,.js ./",
|
|
12
|
-
"lock": "
|
|
13
|
-
"prepublishOnly": "npm test && npm run build && git push --follow-tags origin",
|
|
14
|
-
"prerelease": "npm
|
|
15
|
-
"release": "standard-version",
|
|
16
|
-
"release:pre": "npm run release -- --prerelease",
|
|
17
|
-
"release:major": "npm run release -- --release-as major",
|
|
18
|
-
"release:minor": "npm run release -- --release-as minor",
|
|
19
|
-
"test": "npm run eslint && jest --passWithNoTests",
|
|
20
|
-
"test:cov": "jest --collectCoverage --detectOpenHandles",
|
|
21
|
-
"version": "conventional-changelog -p angular -i CHANGELOG.md -s"
|
|
22
|
-
},
|
|
23
|
-
"main": "./dist/index.js",
|
|
24
|
-
"exports": {
|
|
25
|
-
"require": "./dist/index.js",
|
|
26
|
-
"import": "./dist/index.mjs",
|
|
27
|
-
"types": "./dist/index.d.ts"
|
|
28
|
-
},
|
|
29
|
-
"repository": {
|
|
30
|
-
"type": "git",
|
|
31
|
-
"url": "git+https://github.com/thinkkoa/koatty_cacheable.git"
|
|
32
|
-
},
|
|
33
|
-
"keywords": [
|
|
34
|
-
"cache",
|
|
35
|
-
"store",
|
|
36
|
-
"koatty",
|
|
37
|
-
"thinkkoa"
|
|
38
|
-
],
|
|
39
|
-
"engines": {
|
|
40
|
-
"node": ">10.0.0"
|
|
41
|
-
},
|
|
42
|
-
"author": {
|
|
43
|
-
"name": "richenlin",
|
|
44
|
-
"email": "richenlin@gmail.com"
|
|
45
|
-
},
|
|
46
|
-
"license": "BSD-3-Clause",
|
|
47
|
-
"bugs": {
|
|
48
|
-
"url": "https://github.com/thinkkoa/koatty_cacheable/issues"
|
|
49
|
-
},
|
|
50
|
-
"homepage": "https://github.com/thinkkoa/koatty_cacheable",
|
|
51
|
-
"maintainers": [
|
|
52
|
-
{
|
|
53
|
-
"name": "richenlin",
|
|
54
|
-
"email": "richenlin@gmail.com"
|
|
55
|
-
}
|
|
56
|
-
],
|
|
57
|
-
"devDependencies": {
|
|
58
|
-
"@commitlint/cli": "^19.x.x",
|
|
59
|
-
"@commitlint/config-conventional": "^19.x.x",
|
|
60
|
-
"@
|
|
61
|
-
"@microsoft/api-
|
|
62
|
-
"@
|
|
63
|
-
"@rollup/plugin-
|
|
64
|
-
"@rollup/plugin-
|
|
65
|
-
"@
|
|
66
|
-
"@types/
|
|
67
|
-
"@types/
|
|
68
|
-
"@types/
|
|
69
|
-
"@
|
|
70
|
-
"@typescript-eslint/
|
|
71
|
-
"
|
|
72
|
-
"
|
|
73
|
-
"eslint
|
|
74
|
-
"
|
|
75
|
-
"
|
|
76
|
-
"jest
|
|
77
|
-
"
|
|
78
|
-
"
|
|
79
|
-
"rollup
|
|
80
|
-
"rollup-plugin-
|
|
81
|
-
"
|
|
82
|
-
"
|
|
83
|
-
"ts-
|
|
84
|
-
"
|
|
85
|
-
"
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
"
|
|
90
|
-
"
|
|
91
|
-
"
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
"
|
|
96
|
-
"
|
|
97
|
-
|
|
98
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "koatty_cacheable",
|
|
3
|
+
"version": "1.6.1",
|
|
4
|
+
"description": "Cacheable for koatty.",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"build": "npm run build:js && npm run build:dts && npm run build:doc && npm run build:cp",
|
|
7
|
+
"build:cp": "node scripts/postBuild && npx copyfiles package.json LICENSE README.md dist/",
|
|
8
|
+
"build:js": "npx rollup --bundleConfigAsCjs -c .rollup.config.js",
|
|
9
|
+
"build:doc": "npx api-documenter markdown --input temp --output docs/api",
|
|
10
|
+
"build:dts": "npx tsc && npx api-extractor run --local --verbose",
|
|
11
|
+
"eslint": "eslint --ext .ts,.js ./",
|
|
12
|
+
"lock": "npm i --package-lock-only && npm audit fix && npx pnpm i",
|
|
13
|
+
"prepublishOnly": "npm test && npm run build && git push --follow-tags origin",
|
|
14
|
+
"prerelease": "npm test && npm run build",
|
|
15
|
+
"release": "standard-version",
|
|
16
|
+
"release:pre": "npm run release -- --prerelease",
|
|
17
|
+
"release:major": "npm run release -- --release-as major",
|
|
18
|
+
"release:minor": "npm run release -- --release-as minor",
|
|
19
|
+
"test": "npm run eslint && jest --passWithNoTests",
|
|
20
|
+
"test:cov": "jest --collectCoverage --detectOpenHandles",
|
|
21
|
+
"version": "conventional-changelog -p angular -i CHANGELOG.md -s"
|
|
22
|
+
},
|
|
23
|
+
"main": "./dist/index.js",
|
|
24
|
+
"exports": {
|
|
25
|
+
"require": "./dist/index.js",
|
|
26
|
+
"import": "./dist/index.mjs",
|
|
27
|
+
"types": "./dist/index.d.ts"
|
|
28
|
+
},
|
|
29
|
+
"repository": {
|
|
30
|
+
"type": "git",
|
|
31
|
+
"url": "git+https://github.com/thinkkoa/koatty_cacheable.git"
|
|
32
|
+
},
|
|
33
|
+
"keywords": [
|
|
34
|
+
"cache",
|
|
35
|
+
"store",
|
|
36
|
+
"koatty",
|
|
37
|
+
"thinkkoa"
|
|
38
|
+
],
|
|
39
|
+
"engines": {
|
|
40
|
+
"node": ">10.0.0"
|
|
41
|
+
},
|
|
42
|
+
"author": {
|
|
43
|
+
"name": "richenlin",
|
|
44
|
+
"email": "richenlin@gmail.com"
|
|
45
|
+
},
|
|
46
|
+
"license": "BSD-3-Clause",
|
|
47
|
+
"bugs": {
|
|
48
|
+
"url": "https://github.com/thinkkoa/koatty_cacheable/issues"
|
|
49
|
+
},
|
|
50
|
+
"homepage": "https://github.com/thinkkoa/koatty_cacheable",
|
|
51
|
+
"maintainers": [
|
|
52
|
+
{
|
|
53
|
+
"name": "richenlin",
|
|
54
|
+
"email": "richenlin@gmail.com"
|
|
55
|
+
}
|
|
56
|
+
],
|
|
57
|
+
"devDependencies": {
|
|
58
|
+
"@commitlint/cli": "^19.x.x",
|
|
59
|
+
"@commitlint/config-conventional": "^19.x.x",
|
|
60
|
+
"@commitlint/format": "^19.x.x",
|
|
61
|
+
"@microsoft/api-documenter": "^7.x.x",
|
|
62
|
+
"@microsoft/api-extractor": "^7.x.x",
|
|
63
|
+
"@rollup/plugin-commonjs": "^28.x.x",
|
|
64
|
+
"@rollup/plugin-json": "^6.x.x",
|
|
65
|
+
"@rollup/plugin-node-resolve": "^16.x.x",
|
|
66
|
+
"@types/jest": "^29.x.x",
|
|
67
|
+
"@types/koa": "^2.x.x",
|
|
68
|
+
"@types/lodash": "^4.x.x",
|
|
69
|
+
"@types/node": "^22.x.x",
|
|
70
|
+
"@typescript-eslint/eslint-plugin": "^8.x.x",
|
|
71
|
+
"@typescript-eslint/parser": "^8.x.x",
|
|
72
|
+
"conventional-changelog-cli": "^5.x.x",
|
|
73
|
+
"eslint": "^8.x.x",
|
|
74
|
+
"eslint-plugin-jest": "^28.x.x",
|
|
75
|
+
"husky": "^4.x.x",
|
|
76
|
+
"jest": "^29.x.x",
|
|
77
|
+
"jest-html-reporters": "^3.x.x",
|
|
78
|
+
"reflect-metadata": "^0.x.x",
|
|
79
|
+
"rollup": "^4.x.x",
|
|
80
|
+
"rollup-plugin-delete": "^2.x.x",
|
|
81
|
+
"rollup-plugin-typescript2": "^0.x.x",
|
|
82
|
+
"standard-version": "^9.x.x",
|
|
83
|
+
"ts-jest": "^29.x.x",
|
|
84
|
+
"ts-node": "^10.x.x",
|
|
85
|
+
"tslib": "^2.x.x",
|
|
86
|
+
"typescript": "^5.x.x"
|
|
87
|
+
},
|
|
88
|
+
"dependencies": {
|
|
89
|
+
"koatty_container": "^1.x.x",
|
|
90
|
+
"koatty_lib": "^1.x.x",
|
|
91
|
+
"koatty_logger": "^2.x.x",
|
|
92
|
+
"koatty_store": "^1.8.0"
|
|
93
|
+
},
|
|
94
|
+
"peerDependencies": {
|
|
95
|
+
"koatty_container": "^1.x.x",
|
|
96
|
+
"koatty_lib": "^1.x.x",
|
|
97
|
+
"koatty_logger": "^2.x.x"
|
|
98
|
+
}
|
|
99
|
+
}
|
package/package.json
CHANGED
|
@@ -1,98 +1,99 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "koatty_cacheable",
|
|
3
|
-
"version": "1.6.
|
|
4
|
-
"description": "Cacheable for koatty.",
|
|
5
|
-
"scripts": {
|
|
6
|
-
"build": "npm run build:js && npm run build:dts && npm run build:doc && npm run build:cp",
|
|
7
|
-
"build:cp": "node scripts/postBuild && npx copyfiles package.json LICENSE README.md dist/",
|
|
8
|
-
"build:js": "npx rollup --bundleConfigAsCjs -c .rollup.config.js",
|
|
9
|
-
"build:doc": "npx api-documenter markdown --input temp --output docs/api",
|
|
10
|
-
"build:dts": "npx tsc && npx api-extractor run --local --verbose",
|
|
11
|
-
"eslint": "eslint --ext .ts,.js ./",
|
|
12
|
-
"lock": "
|
|
13
|
-
"prepublishOnly": "npm test && npm run build && git push --follow-tags origin",
|
|
14
|
-
"prerelease": "npm
|
|
15
|
-
"release": "standard-version",
|
|
16
|
-
"release:pre": "npm run release -- --prerelease",
|
|
17
|
-
"release:major": "npm run release -- --release-as major",
|
|
18
|
-
"release:minor": "npm run release -- --release-as minor",
|
|
19
|
-
"test": "npm run eslint && jest --passWithNoTests",
|
|
20
|
-
"test:cov": "jest --collectCoverage --detectOpenHandles",
|
|
21
|
-
"version": "conventional-changelog -p angular -i CHANGELOG.md -s"
|
|
22
|
-
},
|
|
23
|
-
"main": "./dist/index.js",
|
|
24
|
-
"exports": {
|
|
25
|
-
"require": "./dist/index.js",
|
|
26
|
-
"import": "./dist/index.mjs",
|
|
27
|
-
"types": "./dist/index.d.ts"
|
|
28
|
-
},
|
|
29
|
-
"repository": {
|
|
30
|
-
"type": "git",
|
|
31
|
-
"url": "git+https://github.com/thinkkoa/koatty_cacheable.git"
|
|
32
|
-
},
|
|
33
|
-
"keywords": [
|
|
34
|
-
"cache",
|
|
35
|
-
"store",
|
|
36
|
-
"koatty",
|
|
37
|
-
"thinkkoa"
|
|
38
|
-
],
|
|
39
|
-
"engines": {
|
|
40
|
-
"node": ">10.0.0"
|
|
41
|
-
},
|
|
42
|
-
"author": {
|
|
43
|
-
"name": "richenlin",
|
|
44
|
-
"email": "richenlin@gmail.com"
|
|
45
|
-
},
|
|
46
|
-
"license": "BSD-3-Clause",
|
|
47
|
-
"bugs": {
|
|
48
|
-
"url": "https://github.com/thinkkoa/koatty_cacheable/issues"
|
|
49
|
-
},
|
|
50
|
-
"homepage": "https://github.com/thinkkoa/koatty_cacheable",
|
|
51
|
-
"maintainers": [
|
|
52
|
-
{
|
|
53
|
-
"name": "richenlin",
|
|
54
|
-
"email": "richenlin@gmail.com"
|
|
55
|
-
}
|
|
56
|
-
],
|
|
57
|
-
"devDependencies": {
|
|
58
|
-
"@commitlint/cli": "^19.x.x",
|
|
59
|
-
"@commitlint/config-conventional": "^19.x.x",
|
|
60
|
-
"@
|
|
61
|
-
"@microsoft/api-
|
|
62
|
-
"@
|
|
63
|
-
"@rollup/plugin-
|
|
64
|
-
"@rollup/plugin-
|
|
65
|
-
"@
|
|
66
|
-
"@types/
|
|
67
|
-
"@types/
|
|
68
|
-
"@types/
|
|
69
|
-
"@
|
|
70
|
-
"@typescript-eslint/
|
|
71
|
-
"
|
|
72
|
-
"
|
|
73
|
-
"eslint
|
|
74
|
-
"
|
|
75
|
-
"
|
|
76
|
-
"jest
|
|
77
|
-
"
|
|
78
|
-
"
|
|
79
|
-
"rollup
|
|
80
|
-
"rollup-plugin-
|
|
81
|
-
"
|
|
82
|
-
"
|
|
83
|
-
"ts-
|
|
84
|
-
"
|
|
85
|
-
"
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
"
|
|
90
|
-
"
|
|
91
|
-
"
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
"
|
|
96
|
-
"
|
|
97
|
-
|
|
98
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "koatty_cacheable",
|
|
3
|
+
"version": "1.6.1",
|
|
4
|
+
"description": "Cacheable for koatty.",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"build": "npm run build:js && npm run build:dts && npm run build:doc && npm run build:cp",
|
|
7
|
+
"build:cp": "node scripts/postBuild && npx copyfiles package.json LICENSE README.md dist/",
|
|
8
|
+
"build:js": "npx rollup --bundleConfigAsCjs -c .rollup.config.js",
|
|
9
|
+
"build:doc": "npx api-documenter markdown --input temp --output docs/api",
|
|
10
|
+
"build:dts": "npx tsc && npx api-extractor run --local --verbose",
|
|
11
|
+
"eslint": "eslint --ext .ts,.js ./",
|
|
12
|
+
"lock": "npm i --package-lock-only && npm audit fix && npx pnpm i",
|
|
13
|
+
"prepublishOnly": "npm test && npm run build && git push --follow-tags origin",
|
|
14
|
+
"prerelease": "npm test && npm run build",
|
|
15
|
+
"release": "standard-version",
|
|
16
|
+
"release:pre": "npm run release -- --prerelease",
|
|
17
|
+
"release:major": "npm run release -- --release-as major",
|
|
18
|
+
"release:minor": "npm run release -- --release-as minor",
|
|
19
|
+
"test": "npm run eslint && jest --passWithNoTests",
|
|
20
|
+
"test:cov": "jest --collectCoverage --detectOpenHandles",
|
|
21
|
+
"version": "conventional-changelog -p angular -i CHANGELOG.md -s"
|
|
22
|
+
},
|
|
23
|
+
"main": "./dist/index.js",
|
|
24
|
+
"exports": {
|
|
25
|
+
"require": "./dist/index.js",
|
|
26
|
+
"import": "./dist/index.mjs",
|
|
27
|
+
"types": "./dist/index.d.ts"
|
|
28
|
+
},
|
|
29
|
+
"repository": {
|
|
30
|
+
"type": "git",
|
|
31
|
+
"url": "git+https://github.com/thinkkoa/koatty_cacheable.git"
|
|
32
|
+
},
|
|
33
|
+
"keywords": [
|
|
34
|
+
"cache",
|
|
35
|
+
"store",
|
|
36
|
+
"koatty",
|
|
37
|
+
"thinkkoa"
|
|
38
|
+
],
|
|
39
|
+
"engines": {
|
|
40
|
+
"node": ">10.0.0"
|
|
41
|
+
},
|
|
42
|
+
"author": {
|
|
43
|
+
"name": "richenlin",
|
|
44
|
+
"email": "richenlin@gmail.com"
|
|
45
|
+
},
|
|
46
|
+
"license": "BSD-3-Clause",
|
|
47
|
+
"bugs": {
|
|
48
|
+
"url": "https://github.com/thinkkoa/koatty_cacheable/issues"
|
|
49
|
+
},
|
|
50
|
+
"homepage": "https://github.com/thinkkoa/koatty_cacheable",
|
|
51
|
+
"maintainers": [
|
|
52
|
+
{
|
|
53
|
+
"name": "richenlin",
|
|
54
|
+
"email": "richenlin@gmail.com"
|
|
55
|
+
}
|
|
56
|
+
],
|
|
57
|
+
"devDependencies": {
|
|
58
|
+
"@commitlint/cli": "^19.x.x",
|
|
59
|
+
"@commitlint/config-conventional": "^19.x.x",
|
|
60
|
+
"@commitlint/format": "^19.x.x",
|
|
61
|
+
"@microsoft/api-documenter": "^7.x.x",
|
|
62
|
+
"@microsoft/api-extractor": "^7.x.x",
|
|
63
|
+
"@rollup/plugin-commonjs": "^28.x.x",
|
|
64
|
+
"@rollup/plugin-json": "^6.x.x",
|
|
65
|
+
"@rollup/plugin-node-resolve": "^16.x.x",
|
|
66
|
+
"@types/jest": "^29.x.x",
|
|
67
|
+
"@types/koa": "^2.x.x",
|
|
68
|
+
"@types/lodash": "^4.x.x",
|
|
69
|
+
"@types/node": "^22.x.x",
|
|
70
|
+
"@typescript-eslint/eslint-plugin": "^8.x.x",
|
|
71
|
+
"@typescript-eslint/parser": "^8.x.x",
|
|
72
|
+
"conventional-changelog-cli": "^5.x.x",
|
|
73
|
+
"eslint": "^8.x.x",
|
|
74
|
+
"eslint-plugin-jest": "^28.x.x",
|
|
75
|
+
"husky": "^4.x.x",
|
|
76
|
+
"jest": "^29.x.x",
|
|
77
|
+
"jest-html-reporters": "^3.x.x",
|
|
78
|
+
"reflect-metadata": "^0.x.x",
|
|
79
|
+
"rollup": "^4.x.x",
|
|
80
|
+
"rollup-plugin-delete": "^2.x.x",
|
|
81
|
+
"rollup-plugin-typescript2": "^0.x.x",
|
|
82
|
+
"standard-version": "^9.x.x",
|
|
83
|
+
"ts-jest": "^29.x.x",
|
|
84
|
+
"ts-node": "^10.x.x",
|
|
85
|
+
"tslib": "^2.x.x",
|
|
86
|
+
"typescript": "^5.x.x"
|
|
87
|
+
},
|
|
88
|
+
"dependencies": {
|
|
89
|
+
"koatty_container": "^1.x.x",
|
|
90
|
+
"koatty_lib": "^1.x.x",
|
|
91
|
+
"koatty_logger": "^2.x.x",
|
|
92
|
+
"koatty_store": "^1.8.0"
|
|
93
|
+
},
|
|
94
|
+
"peerDependencies": {
|
|
95
|
+
"koatty_container": "^1.x.x",
|
|
96
|
+
"koatty_lib": "^1.x.x",
|
|
97
|
+
"koatty_logger": "^2.x.x"
|
|
98
|
+
}
|
|
99
|
+
}
|