@rx-ted/packages-honest-plugins 1.0.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/CHANGELOG.md +13 -0
- package/README.md +45 -0
- package/api-doc/.turbo/turbo-build.log +1 -0
- package/api-doc/.turbo/turbo-test.log +11 -0
- package/api-doc/.turbo/turbo-typecheck.log +1 -0
- package/api-doc/CHANGELOG.md +22 -0
- package/api-doc/README.md +80 -0
- package/api-doc/dist/api-doc.plugin.d.ts +53 -0
- package/api-doc/dist/api-doc.plugin.js +452 -0
- package/api-doc/dist/index.d.ts +5 -0
- package/api-doc/dist/index.js +3 -0
- package/api-doc/dist/interfaces/renderer.interface.d.ts +7 -0
- package/api-doc/dist/interfaces/renderer.interface.js +1 -0
- package/api-doc/dist/renderers/scalar.renderer.d.ts +10 -0
- package/api-doc/dist/renderers/scalar.renderer.js +76 -0
- package/api-doc/dist/renderers/swagger.renderer.d.ts +10 -0
- package/api-doc/dist/renderers/swagger.renderer.js +83 -0
- package/api-doc/node_modules/.bin/esbuild +22 -0
- package/api-doc/node_modules/.bin/jiti +22 -0
- package/api-doc/node_modules/.bin/sass +22 -0
- package/api-doc/node_modules/.bin/tsx +22 -0
- package/api-doc/node_modules/.bin/vite +22 -0
- package/api-doc/node_modules/.bin/vitest +22 -0
- package/api-doc/node_modules/.bin/yaml +22 -0
- package/api-doc/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json +1 -0
- package/api-doc/package.json +48 -0
- package/api-doc/src/api-doc.plugin.ts +554 -0
- package/api-doc/src/index.ts +5 -0
- package/api-doc/src/interfaces/renderer.interface.ts +5 -0
- package/api-doc/src/plugin.test.ts +740 -0
- package/api-doc/src/renderers/scalar.renderer.ts +82 -0
- package/api-doc/src/renderers/swagger.renderer.ts +89 -0
- package/api-doc/tsconfig.json +21 -0
- package/api-doc/vitest.config.ts +13 -0
- package/cache/.turbo/turbo-build.log +1 -0
- package/cache/.turbo/turbo-test.log +16 -0
- package/cache/CHANGELOG.md +23 -0
- package/cache/README.md +79 -0
- package/cache/dist/cache-service.d.ts +8 -0
- package/cache/dist/cache-service.js +21 -0
- package/cache/dist/cacheable.d.ts +2 -0
- package/cache/dist/cacheable.js +10 -0
- package/cache/dist/cloudflare/driver.d.ts +23 -0
- package/cache/dist/cloudflare/driver.js +102 -0
- package/cache/dist/cloudflare/index.d.ts +3 -0
- package/cache/dist/cloudflare/index.js +2 -0
- package/cache/dist/cloudflare/plugin.d.ts +19 -0
- package/cache/dist/cloudflare/plugin.js +58 -0
- package/cache/dist/index.d.ts +11 -0
- package/cache/dist/index.js +14 -0
- package/cache/dist/local/driver.d.ts +2 -0
- package/cache/dist/local/driver.js +98 -0
- package/cache/dist/local/index.d.ts +2 -0
- package/cache/dist/local/index.js +2 -0
- package/cache/dist/local/plugin.d.ts +14 -0
- package/cache/dist/local/plugin.js +24 -0
- package/cache/dist/redis/driver.d.ts +10 -0
- package/cache/dist/redis/driver.js +102 -0
- package/cache/dist/redis/index.d.ts +4 -0
- package/cache/dist/redis/index.js +2 -0
- package/cache/dist/redis/plugin.d.ts +25 -0
- package/cache/dist/redis/plugin.js +61 -0
- package/cache/dist/resolve.d.ts +24 -0
- package/cache/dist/resolve.js +114 -0
- package/cache/dist/types.d.ts +18 -0
- package/cache/dist/types.js +1 -0
- package/cache/node_modules/.bin/esbuild +22 -0
- package/cache/node_modules/.bin/jiti +22 -0
- package/cache/node_modules/.bin/sass +22 -0
- package/cache/node_modules/.bin/tsx +22 -0
- package/cache/node_modules/.bin/vite +22 -0
- package/cache/node_modules/.bin/vitest +22 -0
- package/cache/node_modules/.bin/yaml +22 -0
- package/cache/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json +1 -0
- package/cache/package.json +46 -0
- package/cache/src/cache-service.test.ts +16 -0
- package/cache/src/cache-service.ts +15 -0
- package/cache/src/cacheable.test.ts +78 -0
- package/cache/src/cacheable.ts +16 -0
- package/cache/src/cloudflare/driver.test.ts +188 -0
- package/cache/src/cloudflare/driver.ts +118 -0
- package/cache/src/cloudflare/index.ts +3 -0
- package/cache/src/cloudflare/plugin.ts +71 -0
- package/cache/src/index.test.ts +68 -0
- package/cache/src/index.ts +20 -0
- package/cache/src/local/driver.ts +117 -0
- package/cache/src/local/index.ts +2 -0
- package/cache/src/local/plugin.ts +34 -0
- package/cache/src/redis/driver.test.ts +71 -0
- package/cache/src/redis/driver.ts +124 -0
- package/cache/src/redis/index.ts +4 -0
- package/cache/src/redis/plugin.ts +84 -0
- package/cache/src/resolve.test.ts +257 -0
- package/cache/src/resolve.ts +140 -0
- package/cache/src/types.ts +14 -0
- package/cache/tsconfig.json +21 -0
- package/cache/vitest.config.ts +13 -0
- package/db/.turbo/turbo-build.log +1 -0
- package/db/.turbo/turbo-test.log +21 -0
- package/db/CHANGELOG.md +26 -0
- package/db/README.md +99 -0
- package/db/dist/constants.d.ts +1 -0
- package/db/dist/constants.js +1 -0
- package/db/dist/d1/index.d.ts +3 -0
- package/db/dist/d1/index.js +2 -0
- package/db/dist/d1/plugin.d.ts +18 -0
- package/db/dist/d1/plugin.js +104 -0
- package/db/dist/db-service.d.ts +7 -0
- package/db/dist/db-service.js +21 -0
- package/db/dist/index.d.ts +15 -0
- package/db/dist/index.js +20 -0
- package/db/dist/mysql/client.d.ts +36 -0
- package/db/dist/mysql/client.js +84 -0
- package/db/dist/mysql/driver.d.ts +18 -0
- package/db/dist/mysql/driver.js +107 -0
- package/db/dist/mysql/index.d.ts +11 -0
- package/db/dist/mysql/index.js +11 -0
- package/db/dist/mysql/plugin.d.ts +51 -0
- package/db/dist/mysql/plugin.js +94 -0
- package/db/dist/mysql/types.d.ts +38 -0
- package/db/dist/mysql/types.js +1 -0
- package/db/dist/postgres/index.d.ts +2 -0
- package/db/dist/postgres/index.js +3 -0
- package/db/dist/repository.d.ts +14 -0
- package/db/dist/repository.js +79 -0
- package/db/dist/resolve.d.ts +6 -0
- package/db/dist/resolve.js +81 -0
- package/db/dist/schema-builder/column-builder.d.ts +26 -0
- package/db/dist/schema-builder/column-builder.js +53 -0
- package/db/dist/schema-builder/compile-d1.d.ts +5 -0
- package/db/dist/schema-builder/compile-d1.js +67 -0
- package/db/dist/schema-builder/compile-mysql.d.ts +12 -0
- package/db/dist/schema-builder/compile-mysql.js +78 -0
- package/db/dist/schema-builder/index.d.ts +8 -0
- package/db/dist/schema-builder/index.js +22 -0
- package/db/dist/schema-builder/table-builder.d.ts +16 -0
- package/db/dist/schema-builder/table-builder.js +38 -0
- package/db/dist/schema-builder/types.d.ts +26 -0
- package/db/dist/schema-builder/types.js +1 -0
- package/db/dist/schema-builder/zod-bridge.d.ts +24 -0
- package/db/dist/schema-builder/zod-bridge.js +53 -0
- package/db/dist/sqlite/index.d.ts +4 -0
- package/db/dist/sqlite/index.js +2 -0
- package/db/dist/sqlite/plugin.d.ts +17 -0
- package/db/dist/sqlite/plugin.js +33 -0
- package/db/dist/types.d.ts +42 -0
- package/db/dist/types.js +1 -0
- package/db/node_modules/.bin/esbuild +22 -0
- package/db/node_modules/.bin/jiti +22 -0
- package/db/node_modules/.bin/sass +22 -0
- package/db/node_modules/.bin/tsx +22 -0
- package/db/node_modules/.bin/vite +22 -0
- package/db/node_modules/.bin/vitest +22 -0
- package/db/node_modules/.bin/yaml +22 -0
- package/db/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json +1 -0
- package/db/package.json +59 -0
- package/db/src/constants.test.ts +8 -0
- package/db/src/constants.ts +1 -0
- package/db/src/d1/index.ts +13 -0
- package/db/src/d1/plugin.ts +135 -0
- package/db/src/db-service.ts +14 -0
- package/db/src/index.test.ts +63 -0
- package/db/src/index.ts +57 -0
- package/db/src/mysql/client.ts +112 -0
- package/db/src/mysql/driver.test.ts +190 -0
- package/db/src/mysql/driver.ts +116 -0
- package/db/src/mysql/index.ts +51 -0
- package/db/src/mysql/plugin.test.ts +228 -0
- package/db/src/mysql/plugin.ts +128 -0
- package/db/src/mysql/types.ts +32 -0
- package/db/src/postgres/index.ts +15 -0
- package/db/src/repository.test.ts +195 -0
- package/db/src/repository.ts +95 -0
- package/db/src/resolve.ts +105 -0
- package/db/src/schema-builder/column-builder.test.ts +55 -0
- package/db/src/schema-builder/column-builder.ts +87 -0
- package/db/src/schema-builder/compile-d1.test.ts +60 -0
- package/db/src/schema-builder/compile-d1.ts +70 -0
- package/db/src/schema-builder/compile-mysql.test.ts +64 -0
- package/db/src/schema-builder/compile-mysql.ts +102 -0
- package/db/src/schema-builder/index.test.ts +36 -0
- package/db/src/schema-builder/index.ts +41 -0
- package/db/src/schema-builder/table-builder.test.ts +55 -0
- package/db/src/schema-builder/table-builder.ts +50 -0
- package/db/src/schema-builder/types.test.ts +68 -0
- package/db/src/schema-builder/types.ts +30 -0
- package/db/src/schema-builder/zod-bridge.ts +89 -0
- package/db/src/sqlite/index.ts +14 -0
- package/db/src/sqlite/plugin.ts +46 -0
- package/db/src/types.ts +45 -0
- package/db/tsconfig.json +21 -0
- package/db/vitest.config.ts +13 -0
- package/mail/.turbo/turbo-build.log +1 -0
- package/mail/.turbo/turbo-test.log +12 -0
- package/mail/.turbo/turbo-typecheck.log +1 -0
- package/mail/CHANGELOG.md +25 -0
- package/mail/README.md +214 -0
- package/mail/dist/index.d.ts +4 -0
- package/mail/dist/index.js +2 -0
- package/mail/dist/plugin.d.ts +64 -0
- package/mail/dist/plugin.js +232 -0
- package/mail/dist/providers/brevo.provider.d.ts +15 -0
- package/mail/dist/providers/brevo.provider.js +75 -0
- package/mail/dist/providers/custom.provider.d.ts +9 -0
- package/mail/dist/providers/custom.provider.js +22 -0
- package/mail/dist/providers/resend.provider.d.ts +16 -0
- package/mail/dist/providers/resend.provider.js +77 -0
- package/mail/dist/providers/smtp.provider.d.ts +21 -0
- package/mail/dist/providers/smtp.provider.js +86 -0
- package/mail/dist/rate-limiter.d.ts +16 -0
- package/mail/dist/rate-limiter.js +49 -0
- package/mail/dist/types.d.ts +68 -0
- package/mail/dist/types.js +6 -0
- package/mail/node_modules/.bin/esbuild +22 -0
- package/mail/node_modules/.bin/jiti +22 -0
- package/mail/node_modules/.bin/sass +22 -0
- package/mail/node_modules/.bin/tsx +22 -0
- package/mail/node_modules/.bin/vite +22 -0
- package/mail/node_modules/.bin/vitest +22 -0
- package/mail/node_modules/.bin/yaml +22 -0
- package/mail/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json +1 -0
- package/mail/package.json +52 -0
- package/mail/src/index.ts +4 -0
- package/mail/src/plugin.test.ts +219 -0
- package/mail/src/plugin.ts +313 -0
- package/mail/src/providers/brevo.provider.ts +78 -0
- package/mail/src/providers/custom.provider.ts +29 -0
- package/mail/src/providers/resend.provider.ts +74 -0
- package/mail/src/providers/smtp.provider.ts +85 -0
- package/mail/src/rate-limiter.test.ts +81 -0
- package/mail/src/rate-limiter.ts +54 -0
- package/mail/src/types.ts +81 -0
- package/mail/tsconfig.json +21 -0
- package/mail/vitest.config.ts +13 -0
- package/package.json +36 -0
- package/s3/.turbo/turbo-build.log +1 -0
- package/s3/.turbo/turbo-test.log +11 -0
- package/s3/CHANGELOG.md +20 -0
- package/s3/README.md +90 -0
- package/s3/dist/index.d.ts +6 -0
- package/s3/dist/index.js +4 -0
- package/s3/dist/s3-service.d.ts +7 -0
- package/s3/dist/s3-service.js +21 -0
- package/s3/dist/s3.driver.d.ts +6 -0
- package/s3/dist/s3.driver.js +221 -0
- package/s3/dist/s3.plugin.d.ts +24 -0
- package/s3/dist/s3.plugin.js +58 -0
- package/s3/dist/types.d.ts +30 -0
- package/s3/dist/types.js +1 -0
- package/s3/node_modules/.bin/esbuild +22 -0
- package/s3/node_modules/.bin/jiti +22 -0
- package/s3/node_modules/.bin/sass +22 -0
- package/s3/node_modules/.bin/tsx +22 -0
- package/s3/node_modules/.bin/vite +22 -0
- package/s3/node_modules/.bin/vitest +22 -0
- package/s3/node_modules/.bin/yaml +22 -0
- package/s3/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json +1 -0
- package/s3/package.json +47 -0
- package/s3/src/index.test.ts +20 -0
- package/s3/src/index.ts +13 -0
- package/s3/src/s3-service.ts +14 -0
- package/s3/src/s3.driver.ts +259 -0
- package/s3/src/s3.plugin.ts +80 -0
- package/s3/src/types.ts +37 -0
- package/s3/tsconfig.json +21 -0
- package/s3/vitest.config.ts +13 -0
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
export function createLocalCacheDriver() {
|
|
2
|
+
const store = new Map();
|
|
3
|
+
function isExpired(entry) {
|
|
4
|
+
return entry.expiresAt !== null && Date.now() > entry.expiresAt;
|
|
5
|
+
}
|
|
6
|
+
function prune() {
|
|
7
|
+
for (const [key, entry] of store) {
|
|
8
|
+
if (isExpired(entry))
|
|
9
|
+
store.delete(key);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
return {
|
|
13
|
+
async get(key) {
|
|
14
|
+
const entry = store.get(key);
|
|
15
|
+
if (!entry || isExpired(entry)) {
|
|
16
|
+
store.delete(key);
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
return entry.value;
|
|
20
|
+
},
|
|
21
|
+
async set(key, value, ttl) {
|
|
22
|
+
store.set(key, {
|
|
23
|
+
value,
|
|
24
|
+
expiresAt: ttl ? Date.now() + ttl * 1000 : null,
|
|
25
|
+
});
|
|
26
|
+
return true;
|
|
27
|
+
},
|
|
28
|
+
async delete(key) {
|
|
29
|
+
return store.delete(key);
|
|
30
|
+
},
|
|
31
|
+
async exists(key) {
|
|
32
|
+
const entry = store.get(key);
|
|
33
|
+
if (!entry || isExpired(entry)) {
|
|
34
|
+
store.delete(key);
|
|
35
|
+
return false;
|
|
36
|
+
}
|
|
37
|
+
return true;
|
|
38
|
+
},
|
|
39
|
+
async mget(keys) {
|
|
40
|
+
return keys.map((key) => {
|
|
41
|
+
const entry = store.get(key);
|
|
42
|
+
if (!entry || isExpired(entry)) {
|
|
43
|
+
store.delete(key);
|
|
44
|
+
return null;
|
|
45
|
+
}
|
|
46
|
+
return entry.value;
|
|
47
|
+
});
|
|
48
|
+
},
|
|
49
|
+
async mset(items) {
|
|
50
|
+
for (const item of items) {
|
|
51
|
+
store.set(item.key, {
|
|
52
|
+
value: item.value,
|
|
53
|
+
expiresAt: item.ttl ? Date.now() + item.ttl * 1000 : null,
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
return true;
|
|
57
|
+
},
|
|
58
|
+
async deleteByPattern(pattern) {
|
|
59
|
+
const regex = new RegExp(pattern.replace(/\*/g, '.*'));
|
|
60
|
+
let count = 0;
|
|
61
|
+
for (const key of store.keys()) {
|
|
62
|
+
if (regex.test(key)) {
|
|
63
|
+
store.delete(key);
|
|
64
|
+
count++;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
return count;
|
|
68
|
+
},
|
|
69
|
+
async incr(key) {
|
|
70
|
+
const entry = store.get(key);
|
|
71
|
+
const current = entry && !isExpired(entry) ? entry.value : 0;
|
|
72
|
+
const next = current + 1;
|
|
73
|
+
store.set(key, { value: next, expiresAt: null });
|
|
74
|
+
return next;
|
|
75
|
+
},
|
|
76
|
+
async decr(key) {
|
|
77
|
+
const entry = store.get(key);
|
|
78
|
+
const current = entry && !isExpired(entry) ? entry.value : 0;
|
|
79
|
+
const next = current - 1;
|
|
80
|
+
store.set(key, { value: next, expiresAt: null });
|
|
81
|
+
return next;
|
|
82
|
+
},
|
|
83
|
+
async expire(key, ttl) {
|
|
84
|
+
const entry = store.get(key);
|
|
85
|
+
if (!entry)
|
|
86
|
+
return false;
|
|
87
|
+
entry.expiresAt = Date.now() + ttl * 1000;
|
|
88
|
+
return true;
|
|
89
|
+
},
|
|
90
|
+
async close() {
|
|
91
|
+
store.clear();
|
|
92
|
+
},
|
|
93
|
+
async healthCheck() {
|
|
94
|
+
prune();
|
|
95
|
+
return true;
|
|
96
|
+
},
|
|
97
|
+
};
|
|
98
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Hono } from 'hono';
|
|
2
|
+
import type { ILogger } from '@rx-ted/packages-core';
|
|
3
|
+
import type { IPlugin, Application } from '@rx-ted/packages-honest';
|
|
4
|
+
export declare const LOCAL_CACHE_CONTEXT_KEY = "honest:local-cache";
|
|
5
|
+
export declare class LocalCachePlugin implements IPlugin {
|
|
6
|
+
static readonly globalKey = "local-cache";
|
|
7
|
+
readonly name = "local-cache-plugin";
|
|
8
|
+
readonly version = "1.0.0";
|
|
9
|
+
logger?: ILogger;
|
|
10
|
+
private driver;
|
|
11
|
+
constructor();
|
|
12
|
+
beforeModulesRegistered(app: Application, _hono: Hono): Promise<void>;
|
|
13
|
+
close(): Promise<void>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { ComponentManager, resolvePluginLogger } from '@rx-ted/packages-honest';
|
|
2
|
+
import { createLocalCacheDriver } from './driver';
|
|
3
|
+
import { CACHE_GLOBAL_KEY } from '../cache-service';
|
|
4
|
+
export const LOCAL_CACHE_CONTEXT_KEY = 'honest:local-cache';
|
|
5
|
+
export class LocalCachePlugin {
|
|
6
|
+
static globalKey = 'local-cache';
|
|
7
|
+
name = 'local-cache-plugin';
|
|
8
|
+
version = '1.0.0';
|
|
9
|
+
logger;
|
|
10
|
+
driver;
|
|
11
|
+
constructor() {
|
|
12
|
+
this.driver = createLocalCacheDriver();
|
|
13
|
+
}
|
|
14
|
+
async beforeModulesRegistered(app, _hono) {
|
|
15
|
+
this.logger ??= resolvePluginLogger(this.name);
|
|
16
|
+
this.logger.info('Local cache: initializing in-memory cache...');
|
|
17
|
+
app.getContext().set(LOCAL_CACHE_CONTEXT_KEY, this.driver);
|
|
18
|
+
ComponentManager.registerPlugin(CACHE_GLOBAL_KEY, this.driver);
|
|
19
|
+
this.logger.info('Local cache: ready');
|
|
20
|
+
}
|
|
21
|
+
async close() {
|
|
22
|
+
await this.driver.close();
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { CacheDriver } from '../types';
|
|
2
|
+
export interface RedisClientOptions {
|
|
3
|
+
url?: string;
|
|
4
|
+
host?: string;
|
|
5
|
+
port?: number;
|
|
6
|
+
username?: string;
|
|
7
|
+
password?: string;
|
|
8
|
+
db?: number;
|
|
9
|
+
}
|
|
10
|
+
export declare function createRedisDriver(options: RedisClientOptions): Promise<CacheDriver>;
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { createClient } from 'redis';
|
|
2
|
+
export async function createRedisDriver(options) {
|
|
3
|
+
const client = createClient(options.url
|
|
4
|
+
? { url: options.url }
|
|
5
|
+
: {
|
|
6
|
+
socket: {
|
|
7
|
+
host: options.host ?? '127.0.0.1',
|
|
8
|
+
port: options.port ?? 6379,
|
|
9
|
+
},
|
|
10
|
+
username: options.username,
|
|
11
|
+
password: options.password,
|
|
12
|
+
database: options.db ?? 0,
|
|
13
|
+
});
|
|
14
|
+
await client.connect();
|
|
15
|
+
return new RedisDriver(client);
|
|
16
|
+
}
|
|
17
|
+
class RedisDriver {
|
|
18
|
+
client;
|
|
19
|
+
constructor(client) {
|
|
20
|
+
this.client = client;
|
|
21
|
+
}
|
|
22
|
+
async get(key) {
|
|
23
|
+
const value = await this.client.get(key);
|
|
24
|
+
if (value === null)
|
|
25
|
+
return null;
|
|
26
|
+
return JSON.parse(value);
|
|
27
|
+
}
|
|
28
|
+
async set(key, value, ttl) {
|
|
29
|
+
const serialized = JSON.stringify(value);
|
|
30
|
+
let result;
|
|
31
|
+
if (ttl) {
|
|
32
|
+
result = await this.client.setEx(key, ttl, serialized);
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
result = (await this.client.set(key, serialized)) ?? '';
|
|
36
|
+
}
|
|
37
|
+
return result === 'OK';
|
|
38
|
+
}
|
|
39
|
+
async delete(key) {
|
|
40
|
+
const result = await this.client.del(key);
|
|
41
|
+
return result > 0;
|
|
42
|
+
}
|
|
43
|
+
async deleteByPattern(pattern) {
|
|
44
|
+
let cursor = 0;
|
|
45
|
+
let total = 0;
|
|
46
|
+
do {
|
|
47
|
+
const result = await this.client.scan(cursor, { MATCH: pattern, COUNT: 100 });
|
|
48
|
+
cursor = result.cursor;
|
|
49
|
+
if (result.keys.length > 0) {
|
|
50
|
+
const count = await this.client.del(result.keys);
|
|
51
|
+
total += count;
|
|
52
|
+
}
|
|
53
|
+
} while (cursor !== 0);
|
|
54
|
+
return total;
|
|
55
|
+
}
|
|
56
|
+
async exists(key) {
|
|
57
|
+
const result = await this.client.exists(key);
|
|
58
|
+
return result > 0;
|
|
59
|
+
}
|
|
60
|
+
async mget(keys) {
|
|
61
|
+
const values = await this.client.mGet(keys);
|
|
62
|
+
return values.map((v) => (v ? JSON.parse(v) : null));
|
|
63
|
+
}
|
|
64
|
+
async mset(items) {
|
|
65
|
+
const pipeline = this.client.multi();
|
|
66
|
+
for (const item of items) {
|
|
67
|
+
const serialized = JSON.stringify(item.value);
|
|
68
|
+
if (item.ttl) {
|
|
69
|
+
pipeline.setEx(item.key, item.ttl, serialized);
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
pipeline.set(item.key, serialized);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
const results = await pipeline.exec();
|
|
76
|
+
if (!results)
|
|
77
|
+
return false;
|
|
78
|
+
return results.every((r) => r === 'OK');
|
|
79
|
+
}
|
|
80
|
+
async incr(key) {
|
|
81
|
+
return this.client.incr(key);
|
|
82
|
+
}
|
|
83
|
+
async decr(key) {
|
|
84
|
+
return this.client.decr(key);
|
|
85
|
+
}
|
|
86
|
+
async expire(key, ttl) {
|
|
87
|
+
const result = (await this.client.expire(key, ttl));
|
|
88
|
+
return result === 1;
|
|
89
|
+
}
|
|
90
|
+
async close() {
|
|
91
|
+
await this.client.quit();
|
|
92
|
+
}
|
|
93
|
+
async healthCheck() {
|
|
94
|
+
try {
|
|
95
|
+
await this.client.ping();
|
|
96
|
+
return true;
|
|
97
|
+
}
|
|
98
|
+
catch {
|
|
99
|
+
return false;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { Hono } from 'hono';
|
|
2
|
+
import type { ILogger } from '@rx-ted/packages-core';
|
|
3
|
+
import type { Application, IPlugin } from '@rx-ted/packages-honest';
|
|
4
|
+
import type { RedisClientOptions } from './driver';
|
|
5
|
+
import type { CacheDriver } from '../types';
|
|
6
|
+
export declare const REDIS_CONTEXT_KEY = "honest:redis";
|
|
7
|
+
export declare const REDIS_GLOBAL_KEY = "redis";
|
|
8
|
+
export interface RedisPluginOptions {
|
|
9
|
+
connection: RedisClientOptions;
|
|
10
|
+
contextKey?: string;
|
|
11
|
+
}
|
|
12
|
+
export declare class RedisPlugin implements IPlugin {
|
|
13
|
+
static readonly globalKey = "redis";
|
|
14
|
+
readonly name = "redis-plugin";
|
|
15
|
+
readonly version = "1.0.0";
|
|
16
|
+
logger?: ILogger;
|
|
17
|
+
private driver;
|
|
18
|
+
private readonly connection;
|
|
19
|
+
private readonly contextKey;
|
|
20
|
+
constructor(options: RedisPluginOptions);
|
|
21
|
+
getClient(): CacheDriver;
|
|
22
|
+
beforeModulesRegistered(app: Application, _hono: Hono): Promise<void>;
|
|
23
|
+
afterModulesRegistered(_app: Application, _hono: Hono): Promise<void>;
|
|
24
|
+
close(): Promise<void>;
|
|
25
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { ComponentManager, maskSensitive, resolvePluginLogger } from '@rx-ted/packages-honest';
|
|
2
|
+
import { createRedisDriver } from './driver';
|
|
3
|
+
import { CACHE_GLOBAL_KEY } from '../cache-service';
|
|
4
|
+
export const REDIS_CONTEXT_KEY = 'honest:redis';
|
|
5
|
+
export const REDIS_GLOBAL_KEY = 'redis';
|
|
6
|
+
export class RedisPlugin {
|
|
7
|
+
static globalKey = REDIS_GLOBAL_KEY;
|
|
8
|
+
name = 'redis-plugin';
|
|
9
|
+
version = '1.0.0';
|
|
10
|
+
logger;
|
|
11
|
+
driver = null;
|
|
12
|
+
connection;
|
|
13
|
+
contextKey;
|
|
14
|
+
constructor(options) {
|
|
15
|
+
this.connection = options.connection;
|
|
16
|
+
this.contextKey = options.contextKey ?? REDIS_CONTEXT_KEY;
|
|
17
|
+
}
|
|
18
|
+
getClient() {
|
|
19
|
+
if (!this.driver) {
|
|
20
|
+
throw new Error('Redis not connected. Ensure beforeModulesRegistered has run.');
|
|
21
|
+
}
|
|
22
|
+
return this.driver;
|
|
23
|
+
}
|
|
24
|
+
async beforeModulesRegistered(app, _hono) {
|
|
25
|
+
this.logger ??= resolvePluginLogger(this.name);
|
|
26
|
+
this.logger.info('Redis: connecting...');
|
|
27
|
+
const connInfo = {
|
|
28
|
+
category: 'plugins',
|
|
29
|
+
host: this.connection.host,
|
|
30
|
+
port: this.connection.port,
|
|
31
|
+
db: this.connection.db,
|
|
32
|
+
username: this.connection.username,
|
|
33
|
+
password: maskSensitive(this.connection.password),
|
|
34
|
+
};
|
|
35
|
+
try {
|
|
36
|
+
this.driver = await createRedisDriver(this.connection);
|
|
37
|
+
app.getContext().set(this.contextKey, this.driver);
|
|
38
|
+
ComponentManager.registerPlugin(CACHE_GLOBAL_KEY, this.driver);
|
|
39
|
+
const ok = await this.driver.healthCheck();
|
|
40
|
+
if (!ok)
|
|
41
|
+
throw new Error('Redis: health check failed');
|
|
42
|
+
this.logger.info(connInfo, 'success to redis');
|
|
43
|
+
}
|
|
44
|
+
catch (error) {
|
|
45
|
+
this.logger.error({ ...connInfo, error: error instanceof Error ? error.message : String(error) }, 'fail to connect redis');
|
|
46
|
+
throw error;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
async afterModulesRegistered(_app, _hono) {
|
|
50
|
+
if (this.driver) {
|
|
51
|
+
const ok = await this.driver.healthCheck();
|
|
52
|
+
if (ok) {
|
|
53
|
+
this.logger?.info('Redis: health check passed');
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
async close() {
|
|
58
|
+
await this.driver?.close();
|
|
59
|
+
this.driver = null;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type Env, resolveBinding } from '@rx-ted/packages-core';
|
|
2
|
+
export { resolveBinding };
|
|
3
|
+
import type { Application, IPlugin } from '@rx-ted/packages-honest';
|
|
4
|
+
import type { RedisClientOptions } from './redis/driver';
|
|
5
|
+
import type { CacheDriver } from './types';
|
|
6
|
+
export interface CachePluginOptions {
|
|
7
|
+
driver?: 'redis' | 'kv' | 'local';
|
|
8
|
+
redis?: RedisClientOptions;
|
|
9
|
+
kvBinding?: string;
|
|
10
|
+
}
|
|
11
|
+
export declare function findKvBinding(env?: Env): string;
|
|
12
|
+
export declare class CachePlugin implements IPlugin {
|
|
13
|
+
private options?;
|
|
14
|
+
readonly name = "cache-plugin";
|
|
15
|
+
readonly version = "1.0.0";
|
|
16
|
+
logger?: import('@rx-ted/packages-core').ILogger;
|
|
17
|
+
private driver;
|
|
18
|
+
constructor(options?: CachePluginOptions | undefined);
|
|
19
|
+
getClient(): CacheDriver;
|
|
20
|
+
beforeModulesRegistered(app: Application): Promise<void>;
|
|
21
|
+
private initCloudflare;
|
|
22
|
+
private initNode;
|
|
23
|
+
close(): Promise<void>;
|
|
24
|
+
}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { ENV_SYMBOL, Platform, resolveBinding } from '@rx-ted/packages-core';
|
|
2
|
+
export { resolveBinding };
|
|
3
|
+
import { ComponentManager, resolvePluginLogger } from '@rx-ted/packages-honest';
|
|
4
|
+
import { createCloudflareKvDriver } from './cloudflare/driver';
|
|
5
|
+
import { createRedisDriver } from './redis/driver';
|
|
6
|
+
import { createLocalCacheDriver } from './local/driver';
|
|
7
|
+
import { CACHE_GLOBAL_KEY } from './cache-service';
|
|
8
|
+
export function findKvBinding(env) {
|
|
9
|
+
const sources = [
|
|
10
|
+
globalThis,
|
|
11
|
+
(globalThis.env ?? {}),
|
|
12
|
+
Platform.env(),
|
|
13
|
+
];
|
|
14
|
+
for (const source of sources) {
|
|
15
|
+
for (const key of Object.keys(source)) {
|
|
16
|
+
const val = source[key];
|
|
17
|
+
if (val && typeof val === 'object' && 'get' in val && 'put' in val && 'delete' in val) {
|
|
18
|
+
const { get, put, delete: del } = val;
|
|
19
|
+
if (typeof get === 'function' && typeof put === 'function' && typeof del === 'function') {
|
|
20
|
+
return key;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return '';
|
|
26
|
+
}
|
|
27
|
+
function resolveRedisConfig(options, env) {
|
|
28
|
+
if (options?.redis)
|
|
29
|
+
return options.redis;
|
|
30
|
+
if (env?.has('REDIS_URL'))
|
|
31
|
+
return { url: env.get('REDIS_URL') };
|
|
32
|
+
if (env?.has('REDIS_HOST')) {
|
|
33
|
+
return {
|
|
34
|
+
host: env.get('REDIS_HOST'),
|
|
35
|
+
port: env.get('REDIS_PORT', 'number'),
|
|
36
|
+
username: env.get('REDIS_USERNAME'),
|
|
37
|
+
password: env.get('REDIS_PASSWORD'),
|
|
38
|
+
db: env.get('REDIS_DB', 'number'),
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
43
|
+
export class CachePlugin {
|
|
44
|
+
options;
|
|
45
|
+
name = 'cache-plugin';
|
|
46
|
+
version = '1.0.0';
|
|
47
|
+
logger;
|
|
48
|
+
driver = null;
|
|
49
|
+
constructor(options) {
|
|
50
|
+
this.options = options;
|
|
51
|
+
}
|
|
52
|
+
getClient() {
|
|
53
|
+
if (!this.driver) {
|
|
54
|
+
throw new Error('Cache not initialized. Ensure beforeModulesRegistered has run.');
|
|
55
|
+
}
|
|
56
|
+
return this.driver;
|
|
57
|
+
}
|
|
58
|
+
async beforeModulesRegistered(app) {
|
|
59
|
+
this.logger ??= resolvePluginLogger(this.name);
|
|
60
|
+
this.logger.info('Cache: initializing...');
|
|
61
|
+
const appEnv = ComponentManager.hasPlugin(ENV_SYMBOL)
|
|
62
|
+
? ComponentManager.getPlugin(ENV_SYMBOL)
|
|
63
|
+
: undefined;
|
|
64
|
+
const explicit = this.options?.driver;
|
|
65
|
+
const platform = appEnv?.platform ?? 'node';
|
|
66
|
+
if (explicit === 'kv' || (!explicit && platform === 'cloudflare')) {
|
|
67
|
+
this.driver = this.initCloudflare(appEnv);
|
|
68
|
+
}
|
|
69
|
+
else if (explicit === 'redis' ||
|
|
70
|
+
(!explicit && (platform === 'node' || platform === 'bun' || platform === 'deno'))) {
|
|
71
|
+
this.driver = await this.initNode(appEnv);
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
this.driver = createLocalCacheDriver();
|
|
75
|
+
}
|
|
76
|
+
app.getContext().set('honest:cache', this.driver);
|
|
77
|
+
ComponentManager.registerPlugin(CACHE_GLOBAL_KEY, this.driver);
|
|
78
|
+
this.logger.info('Cache: ready');
|
|
79
|
+
}
|
|
80
|
+
initCloudflare(env) {
|
|
81
|
+
const bindingName = this.options?.kvBinding || findKvBinding(env);
|
|
82
|
+
if (bindingName) {
|
|
83
|
+
const ns = resolveBinding(bindingName, env);
|
|
84
|
+
if (ns) {
|
|
85
|
+
this.logger?.info('Cache: using Cloudflare KV');
|
|
86
|
+
return createCloudflareKvDriver(ns);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
throw new Error(`Cache: Cloudflare KV binding not found. Configure a KV namespace binding named "${bindingName || '<name>'}" in your wrangler.toml.`);
|
|
90
|
+
}
|
|
91
|
+
async initNode(env) {
|
|
92
|
+
const redisConfig = resolveRedisConfig(this.options, env);
|
|
93
|
+
if (redisConfig) {
|
|
94
|
+
try {
|
|
95
|
+
const driver = await createRedisDriver(redisConfig);
|
|
96
|
+
const ok = await driver.healthCheck();
|
|
97
|
+
if (ok) {
|
|
98
|
+
this.logger?.info('Cache: using Redis');
|
|
99
|
+
return driver;
|
|
100
|
+
}
|
|
101
|
+
this.logger?.warn('Cache: Redis health check failed, falling back to local');
|
|
102
|
+
}
|
|
103
|
+
catch (err) {
|
|
104
|
+
this.logger?.warn({ error: err instanceof Error ? err.message : String(err) }, 'Cache: Redis connection failed, falling back to local');
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
this.logger?.info('Cache: using local in-memory cache');
|
|
108
|
+
return createLocalCacheDriver();
|
|
109
|
+
}
|
|
110
|
+
async close() {
|
|
111
|
+
await this.driver?.close();
|
|
112
|
+
this.driver = null;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export interface CacheDriver {
|
|
2
|
+
get<T = unknown>(key: string): Promise<T | null>;
|
|
3
|
+
set(key: string, value: unknown, ttl?: number): Promise<boolean>;
|
|
4
|
+
delete(key: string): Promise<boolean>;
|
|
5
|
+
exists(key: string): Promise<boolean>;
|
|
6
|
+
mget<T = unknown>(keys: string[]): Promise<(T | null)[]>;
|
|
7
|
+
mset(items: Array<{
|
|
8
|
+
key: string;
|
|
9
|
+
value: unknown;
|
|
10
|
+
ttl?: number;
|
|
11
|
+
}>): Promise<boolean>;
|
|
12
|
+
deleteByPattern(pattern: string): Promise<number>;
|
|
13
|
+
incr(key: string): Promise<number>;
|
|
14
|
+
decr(key: string): Promise<number>;
|
|
15
|
+
expire(key: string, ttl: number): Promise<boolean>;
|
|
16
|
+
close(): Promise<void>;
|
|
17
|
+
healthCheck(): Promise<boolean>;
|
|
18
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
|
3
|
+
|
|
4
|
+
case `uname` in
|
|
5
|
+
*CYGWIN*|*MINGW*|*MSYS*)
|
|
6
|
+
if command -v cygpath > /dev/null 2>&1; then
|
|
7
|
+
basedir=`cygpath -w "$basedir"`
|
|
8
|
+
fi
|
|
9
|
+
;;
|
|
10
|
+
esac
|
|
11
|
+
|
|
12
|
+
if [ -z "$NODE_PATH" ]; then
|
|
13
|
+
export NODE_PATH="/Users/ben/projects/app/node_modules/.pnpm/esbuild@0.28.1/node_modules/esbuild/node_modules:/Users/ben/projects/app/node_modules/.pnpm/esbuild@0.28.1/node_modules:/Users/ben/projects/app/node_modules/.pnpm/node_modules"
|
|
14
|
+
else
|
|
15
|
+
export NODE_PATH="/Users/ben/projects/app/node_modules/.pnpm/esbuild@0.28.1/node_modules/esbuild/node_modules:/Users/ben/projects/app/node_modules/.pnpm/esbuild@0.28.1/node_modules:/Users/ben/projects/app/node_modules/.pnpm/node_modules:$NODE_PATH"
|
|
16
|
+
fi
|
|
17
|
+
if [ -x "$basedir/node" ]; then
|
|
18
|
+
exec "$basedir/node" "$basedir/../../../../../node_modules/.pnpm/esbuild@0.28.1/node_modules/esbuild/bin/esbuild" "$@"
|
|
19
|
+
else
|
|
20
|
+
exec node "$basedir/../../../../../node_modules/.pnpm/esbuild@0.28.1/node_modules/esbuild/bin/esbuild" "$@"
|
|
21
|
+
fi
|
|
22
|
+
# cmd-shim-target=/Users/ben/projects/app/node_modules/.pnpm/esbuild@0.28.1/node_modules/esbuild/bin/esbuild
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
|
3
|
+
|
|
4
|
+
case `uname` in
|
|
5
|
+
*CYGWIN*|*MINGW*|*MSYS*)
|
|
6
|
+
if command -v cygpath > /dev/null 2>&1; then
|
|
7
|
+
basedir=`cygpath -w "$basedir"`
|
|
8
|
+
fi
|
|
9
|
+
;;
|
|
10
|
+
esac
|
|
11
|
+
|
|
12
|
+
if [ -z "$NODE_PATH" ]; then
|
|
13
|
+
export NODE_PATH="/Users/ben/projects/app/node_modules/.pnpm/jiti@2.6.1/node_modules/jiti/node_modules:/Users/ben/projects/app/node_modules/.pnpm/jiti@2.6.1/node_modules:/Users/ben/projects/app/node_modules/.pnpm/node_modules"
|
|
14
|
+
else
|
|
15
|
+
export NODE_PATH="/Users/ben/projects/app/node_modules/.pnpm/jiti@2.6.1/node_modules/jiti/node_modules:/Users/ben/projects/app/node_modules/.pnpm/jiti@2.6.1/node_modules:/Users/ben/projects/app/node_modules/.pnpm/node_modules:$NODE_PATH"
|
|
16
|
+
fi
|
|
17
|
+
if [ -x "$basedir/node" ]; then
|
|
18
|
+
exec "$basedir/node" "$basedir/../../../../../node_modules/.pnpm/jiti@2.6.1/node_modules/jiti/lib/jiti-cli.mjs" "$@"
|
|
19
|
+
else
|
|
20
|
+
exec node "$basedir/../../../../../node_modules/.pnpm/jiti@2.6.1/node_modules/jiti/lib/jiti-cli.mjs" "$@"
|
|
21
|
+
fi
|
|
22
|
+
# cmd-shim-target=/Users/ben/projects/app/node_modules/.pnpm/jiti@2.6.1/node_modules/jiti/lib/jiti-cli.mjs
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
|
3
|
+
|
|
4
|
+
case `uname` in
|
|
5
|
+
*CYGWIN*|*MINGW*|*MSYS*)
|
|
6
|
+
if command -v cygpath > /dev/null 2>&1; then
|
|
7
|
+
basedir=`cygpath -w "$basedir"`
|
|
8
|
+
fi
|
|
9
|
+
;;
|
|
10
|
+
esac
|
|
11
|
+
|
|
12
|
+
if [ -z "$NODE_PATH" ]; then
|
|
13
|
+
export NODE_PATH="/Users/ben/projects/app/node_modules/.pnpm/sass@1.100.0/node_modules/sass/node_modules:/Users/ben/projects/app/node_modules/.pnpm/sass@1.100.0/node_modules:/Users/ben/projects/app/node_modules/.pnpm/node_modules"
|
|
14
|
+
else
|
|
15
|
+
export NODE_PATH="/Users/ben/projects/app/node_modules/.pnpm/sass@1.100.0/node_modules/sass/node_modules:/Users/ben/projects/app/node_modules/.pnpm/sass@1.100.0/node_modules:/Users/ben/projects/app/node_modules/.pnpm/node_modules:$NODE_PATH"
|
|
16
|
+
fi
|
|
17
|
+
if [ -x "$basedir/node" ]; then
|
|
18
|
+
exec "$basedir/node" "$basedir/../../../../../node_modules/.pnpm/sass@1.100.0/node_modules/sass/sass.js" "$@"
|
|
19
|
+
else
|
|
20
|
+
exec node "$basedir/../../../../../node_modules/.pnpm/sass@1.100.0/node_modules/sass/sass.js" "$@"
|
|
21
|
+
fi
|
|
22
|
+
# cmd-shim-target=/Users/ben/projects/app/node_modules/.pnpm/sass@1.100.0/node_modules/sass/sass.js
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
|
3
|
+
|
|
4
|
+
case `uname` in
|
|
5
|
+
*CYGWIN*|*MINGW*|*MSYS*)
|
|
6
|
+
if command -v cygpath > /dev/null 2>&1; then
|
|
7
|
+
basedir=`cygpath -w "$basedir"`
|
|
8
|
+
fi
|
|
9
|
+
;;
|
|
10
|
+
esac
|
|
11
|
+
|
|
12
|
+
if [ -z "$NODE_PATH" ]; then
|
|
13
|
+
export NODE_PATH="/Users/ben/projects/app/node_modules/.pnpm/tsx@4.23.0/node_modules/tsx/node_modules:/Users/ben/projects/app/node_modules/.pnpm/tsx@4.23.0/node_modules:/Users/ben/projects/app/node_modules/.pnpm/node_modules"
|
|
14
|
+
else
|
|
15
|
+
export NODE_PATH="/Users/ben/projects/app/node_modules/.pnpm/tsx@4.23.0/node_modules/tsx/node_modules:/Users/ben/projects/app/node_modules/.pnpm/tsx@4.23.0/node_modules:/Users/ben/projects/app/node_modules/.pnpm/node_modules:$NODE_PATH"
|
|
16
|
+
fi
|
|
17
|
+
if [ -x "$basedir/node" ]; then
|
|
18
|
+
exec "$basedir/node" "$basedir/../../../../../node_modules/.pnpm/tsx@4.23.0/node_modules/tsx/dist/cli.mjs" "$@"
|
|
19
|
+
else
|
|
20
|
+
exec node "$basedir/../../../../../node_modules/.pnpm/tsx@4.23.0/node_modules/tsx/dist/cli.mjs" "$@"
|
|
21
|
+
fi
|
|
22
|
+
# cmd-shim-target=/Users/ben/projects/app/node_modules/.pnpm/tsx@4.23.0/node_modules/tsx/dist/cli.mjs
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
|
3
|
+
|
|
4
|
+
case `uname` in
|
|
5
|
+
*CYGWIN*|*MINGW*|*MSYS*)
|
|
6
|
+
if command -v cygpath > /dev/null 2>&1; then
|
|
7
|
+
basedir=`cygpath -w "$basedir"`
|
|
8
|
+
fi
|
|
9
|
+
;;
|
|
10
|
+
esac
|
|
11
|
+
|
|
12
|
+
if [ -z "$NODE_PATH" ]; then
|
|
13
|
+
export NODE_PATH="/Users/ben/projects/app/node_modules/.pnpm/vite@8.0.16_@types+node@25.9.2_esbuild@0.28.1_jiti@2.6.1_sass@1.100.0_tsx@4.23.0_yaml@2.9.0/node_modules/vite/node_modules:/Users/ben/projects/app/node_modules/.pnpm/vite@8.0.16_@types+node@25.9.2_esbuild@0.28.1_jiti@2.6.1_sass@1.100.0_tsx@4.23.0_yaml@2.9.0/node_modules:/Users/ben/projects/app/node_modules/.pnpm/node_modules"
|
|
14
|
+
else
|
|
15
|
+
export NODE_PATH="/Users/ben/projects/app/node_modules/.pnpm/vite@8.0.16_@types+node@25.9.2_esbuild@0.28.1_jiti@2.6.1_sass@1.100.0_tsx@4.23.0_yaml@2.9.0/node_modules/vite/node_modules:/Users/ben/projects/app/node_modules/.pnpm/vite@8.0.16_@types+node@25.9.2_esbuild@0.28.1_jiti@2.6.1_sass@1.100.0_tsx@4.23.0_yaml@2.9.0/node_modules:/Users/ben/projects/app/node_modules/.pnpm/node_modules:$NODE_PATH"
|
|
16
|
+
fi
|
|
17
|
+
if [ -x "$basedir/node" ]; then
|
|
18
|
+
exec "$basedir/node" "$basedir/../../../../../node_modules/.pnpm/vite@8.0.16_@types+node@25.9.2_esbuild@0.28.1_jiti@2.6.1_sass@1.100.0_tsx@4.23.0_yaml@2.9.0/node_modules/vite/bin/vite.js" "$@"
|
|
19
|
+
else
|
|
20
|
+
exec node "$basedir/../../../../../node_modules/.pnpm/vite@8.0.16_@types+node@25.9.2_esbuild@0.28.1_jiti@2.6.1_sass@1.100.0_tsx@4.23.0_yaml@2.9.0/node_modules/vite/bin/vite.js" "$@"
|
|
21
|
+
fi
|
|
22
|
+
# cmd-shim-target=/Users/ben/projects/app/node_modules/.pnpm/vite@8.0.16_@types+node@25.9.2_esbuild@0.28.1_jiti@2.6.1_sass@1.100.0_tsx@4.23.0_yaml@2.9.0/node_modules/vite/bin/vite.js
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
|
3
|
+
|
|
4
|
+
case `uname` in
|
|
5
|
+
*CYGWIN*|*MINGW*|*MSYS*)
|
|
6
|
+
if command -v cygpath > /dev/null 2>&1; then
|
|
7
|
+
basedir=`cygpath -w "$basedir"`
|
|
8
|
+
fi
|
|
9
|
+
;;
|
|
10
|
+
esac
|
|
11
|
+
|
|
12
|
+
if [ -z "$NODE_PATH" ]; then
|
|
13
|
+
export NODE_PATH="/Users/ben/projects/app/node_modules/.pnpm/vitest@4.1.8_@types+node@25.9.2_@vitest+coverage-v8@4.1.7_jsdom@29.1.1_@noble+hashes@1._7bccdcabe1f1ec543f47b71e54a2d105/node_modules/vitest/node_modules:/Users/ben/projects/app/node_modules/.pnpm/vitest@4.1.8_@types+node@25.9.2_@vitest+coverage-v8@4.1.7_jsdom@29.1.1_@noble+hashes@1._7bccdcabe1f1ec543f47b71e54a2d105/node_modules:/Users/ben/projects/app/node_modules/.pnpm/node_modules"
|
|
14
|
+
else
|
|
15
|
+
export NODE_PATH="/Users/ben/projects/app/node_modules/.pnpm/vitest@4.1.8_@types+node@25.9.2_@vitest+coverage-v8@4.1.7_jsdom@29.1.1_@noble+hashes@1._7bccdcabe1f1ec543f47b71e54a2d105/node_modules/vitest/node_modules:/Users/ben/projects/app/node_modules/.pnpm/vitest@4.1.8_@types+node@25.9.2_@vitest+coverage-v8@4.1.7_jsdom@29.1.1_@noble+hashes@1._7bccdcabe1f1ec543f47b71e54a2d105/node_modules:/Users/ben/projects/app/node_modules/.pnpm/node_modules:$NODE_PATH"
|
|
16
|
+
fi
|
|
17
|
+
if [ -x "$basedir/node" ]; then
|
|
18
|
+
exec "$basedir/node" "$basedir/../vitest/vitest.mjs" "$@"
|
|
19
|
+
else
|
|
20
|
+
exec node "$basedir/../vitest/vitest.mjs" "$@"
|
|
21
|
+
fi
|
|
22
|
+
# cmd-shim-target=/Users/ben/projects/app/packages/honest-plugins/cache/node_modules/vitest/vitest.mjs
|