fix(ts-sdk): lazy-load optional provider SDKs in mem0ai/oss (#6389)

This commit is contained in:
Kartik
2026-07-20 15:53:35 +05:30
committed by GitHub
parent 726bcc80b2
commit 756b0b1b6d
38 changed files with 536 additions and 274 deletions
+10 -1
View File
@@ -22,7 +22,16 @@ function sourceFiles(dir: string, acc: string[] = []): string[] {
for (const entry of readdirSync(dir)) {
const full = join(dir, entry);
if (statSync(full).isDirectory()) {
if (entry !== "tests" && entry !== "__tests__") sourceFiles(full, acc);
// examples/ are dev scripts and community/ is the separate @mem0/community
// package — neither ships in files:["dist"] nor is reachable via the mem0ai/oss
// barrel, so a static import there cannot crash a Memory() consumer.
if (
entry !== "tests" &&
entry !== "__tests__" &&
entry !== "examples" &&
entry !== "community"
)
sourceFiles(full, acc);
} else if (entry.endsWith(".ts") && !entry.endsWith(".test.ts")) {
acc.push(full);
}