veryfront 0.1.97 → 0.1.99

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 (41) hide show
  1. package/esm/cli/commands/styles/command.d.ts +15 -0
  2. package/esm/cli/commands/styles/command.d.ts.map +1 -1
  3. package/esm/cli/commands/styles/command.js +2 -2
  4. package/esm/deno.d.ts +2 -0
  5. package/esm/deno.js +36 -34
  6. package/esm/src/build/production-build/templates.d.ts.map +1 -1
  7. package/esm/src/build/production-build/templates.js +2 -2
  8. package/esm/src/platform/compat/esbuild-shared.d.ts +1 -1
  9. package/esm/src/platform/compat/esbuild-shared.js +1 -1
  10. package/esm/src/platform/compat/std/front-matter-yaml.d.ts.map +1 -1
  11. package/esm/src/platform/compat/std/front-matter-yaml.js +10 -1
  12. package/esm/src/proxy/cache/redis-cache.d.ts +3 -0
  13. package/esm/src/proxy/cache/redis-cache.d.ts.map +1 -1
  14. package/esm/src/proxy/cache/redis-cache.js +15 -2
  15. package/esm/src/proxy/cache/types.d.ts +3 -0
  16. package/esm/src/proxy/cache/types.d.ts.map +1 -1
  17. package/esm/src/react/components/ai/chat/index.d.ts +17 -1
  18. package/esm/src/react/components/ai/chat/index.d.ts.map +1 -1
  19. package/esm/src/react/components/ai/chat/index.js +0 -3
  20. package/esm/src/server/handlers/dev/framework-candidates.generated.d.ts.map +1 -1
  21. package/esm/src/server/handlers/dev/framework-candidates.generated.js +9 -0
  22. package/esm/src/studio/bridge/bridge-bundle.generated.d.ts.map +1 -1
  23. package/esm/src/studio/bridge/bridge-bundle.generated.js +1 -1
  24. package/esm/src/utils/redis-client.d.ts +4 -2
  25. package/esm/src/utils/redis-client.d.ts.map +1 -1
  26. package/esm/src/utils/redis-client.js +21 -1
  27. package/esm/src/utils/version.d.ts +1 -1
  28. package/esm/src/utils/version.js +1 -1
  29. package/package.json +20 -20
  30. package/src/cli/commands/styles/command.ts +4 -2
  31. package/src/deno.js +36 -34
  32. package/src/src/build/production-build/templates.ts +2 -2
  33. package/src/src/platform/compat/esbuild-shared.ts +1 -1
  34. package/src/src/platform/compat/std/front-matter-yaml.ts +17 -2
  35. package/src/src/proxy/cache/redis-cache.ts +15 -3
  36. package/src/src/proxy/cache/types.ts +3 -0
  37. package/src/src/react/components/ai/chat/index.tsx +11 -1
  38. package/src/src/server/handlers/dev/framework-candidates.generated.ts +9 -0
  39. package/src/src/studio/bridge/bridge-bundle.generated.ts +1 -1
  40. package/src/src/utils/redis-client.ts +32 -4
  41. package/src/src/utils/version.ts +1 -1
@@ -19,10 +19,13 @@ export interface RedisClient {
19
19
  isOpen?: boolean;
20
20
  }
21
21
 
22
- interface RedisClientOptions {
22
+ export interface RedisClientOptions {
23
23
  url?: string;
24
24
  connectTimeout?: number;
25
25
  autoReconnect?: boolean;
26
+ tls?: boolean;
27
+ password?: string;
28
+ username?: string;
26
29
  }
27
30
 
28
31
  let sharedClient: RedisClient | null = null;
@@ -64,12 +67,14 @@ export async function getRedisClient(options: RedisClientOptions = {}): Promise<
64
67
  }
65
68
 
66
69
  async function createClient(options: RedisClientOptions): Promise<RedisClient> {
67
- let createClientFn: ((opts: { url?: string }) => RedisClient) | undefined;
70
+ // deno-lint-ignore no-explicit-any
71
+ let createClientFn: ((opts: Record<string, any>) => RedisClient) | undefined;
68
72
 
69
73
  try {
70
74
  const redisClientModule = "npm:@redis/client@1.5.8";
71
75
  const mod = await import(redisClientModule);
72
- createClientFn = mod.createClient as (opts: { url?: string }) => RedisClient;
76
+ // deno-lint-ignore no-explicit-any
77
+ createClientFn = mod.createClient as (opts: Record<string, any>) => RedisClient;
73
78
  } catch (error) {
74
79
  logger.debug("Failed to load @redis/client module", { error });
75
80
  throw DEPENDENCY_MISSING.create({
@@ -78,7 +83,30 @@ async function createClient(options: RedisClientOptions): Promise<RedisClient> {
78
83
  });
79
84
  }
80
85
 
81
- const client = createClientFn({ url: options.url ?? getEnv("REDIS_URL") });
86
+ const url = options.url ?? getEnv("REDIS_URL");
87
+ const useTls = options.tls ?? url?.startsWith("rediss://") ?? false;
88
+
89
+ if (!useTls && getEnv("NODE_ENV") === "production") {
90
+ logger.warn(
91
+ "Redis connection without TLS in production. Set REDIS_URL to rediss:// or pass tls: true.",
92
+ );
93
+ }
94
+
95
+ // deno-lint-ignore no-explicit-any
96
+ const clientOpts: Record<string, any> = { url };
97
+ if (useTls) {
98
+ clientOpts.socket = { tls: true };
99
+ }
100
+ const password = options.password ?? getEnv("REDIS_PASSWORD");
101
+ if (password) {
102
+ clientOpts.password = password;
103
+ }
104
+ const username = options.username ?? getEnv("REDIS_USERNAME");
105
+ if (username) {
106
+ clientOpts.username = username;
107
+ }
108
+
109
+ const client = createClientFn(clientOpts);
82
110
 
83
111
  if (typeof client.on === "function") {
84
112
  client.on("error", (err: unknown) => {
@@ -3,7 +3,7 @@ import { getEnv } from "../platform/compat/process.js";
3
3
 
4
4
  // Keep in sync with deno.json version.
5
5
  // scripts/release.ts updates this constant during releases.
6
- export const VERSION = "0.1.97";
6
+ export const VERSION = "0.1.99";
7
7
 
8
8
  export function normalizeVeryfrontVersion(version: string | undefined): string | undefined {
9
9
  if (!version) return undefined;