mirror of
https://github.com/thedotmack/claude-mem.git
synced 2026-09-20 04:23:02 +08:00
fix(build): ship sqlite runtime modules
(cherry picked from commit bd479590c2)
This commit is contained in:
@@ -348,6 +348,50 @@ async function buildHooks() {
|
||||
);
|
||||
}
|
||||
|
||||
// worker-service.cjs lazy-requires these via createRequire("../sqlite/…"),
|
||||
// intentionally kept external from the worker bundle (#2584). They must ship
|
||||
// as sibling files under plugin/sqlite/, or clean installs can throw
|
||||
// "Cannot find module '../sqlite/SessionStore.js'" when Chroma vector sync
|
||||
// reaches the SQLite helpers (#3107/#3126).
|
||||
console.log(`\n🔧 Building sqlite runtime modules...`);
|
||||
const SQLITE_MODULES = [
|
||||
{ source: 'src/services/sqlite/SessionStore.ts', out: 'plugin/sqlite/SessionStore.js' },
|
||||
{ source: 'src/services/sqlite/observations/files.ts', out: 'plugin/sqlite/observations/files.js' },
|
||||
];
|
||||
for (const mod of SQLITE_MODULES) {
|
||||
fs.mkdirSync(path.dirname(mod.out), { recursive: true });
|
||||
await build({
|
||||
entryPoints: [mod.source],
|
||||
bundle: true,
|
||||
platform: 'node',
|
||||
target: 'node18',
|
||||
format: 'cjs',
|
||||
outfile: mod.out,
|
||||
minify: true,
|
||||
logLevel: 'error',
|
||||
external: [
|
||||
'bun:sqlite',
|
||||
'zod',
|
||||
'cohere-ai',
|
||||
'ollama',
|
||||
'@chroma-core/default-embed',
|
||||
'onnxruntime-node',
|
||||
'better-auth',
|
||||
'better-auth/node',
|
||||
'better-auth/plugins',
|
||||
'@better-auth/api-key',
|
||||
],
|
||||
define: {
|
||||
'__DEFAULT_PACKAGE_VERSION__': `"${version}"`,
|
||||
'import.meta.url': '__IMPORT_META_URL__'
|
||||
},
|
||||
banner: {
|
||||
js: 'var __IMPORT_META_URL__ = require("node:url").pathToFileURL(__filename).href;'
|
||||
}
|
||||
});
|
||||
console.log(`✓ ${mod.out} built (${(fs.statSync(mod.out).size / 1024).toFixed(2)} KB)`);
|
||||
}
|
||||
|
||||
console.log(`\n🔧 Building server beta service...`);
|
||||
await build({
|
||||
entryPoints: [SERVER_SERVICE.source],
|
||||
@@ -620,6 +664,8 @@ async function buildHooks() {
|
||||
'plugin/hooks/hooks.json',
|
||||
'plugin/hooks/codex-hooks.json',
|
||||
'plugin/scripts/bun-runner.js',
|
||||
'plugin/sqlite/SessionStore.js',
|
||||
'plugin/sqlite/observations/files.js',
|
||||
'plugin/.claude-plugin/plugin.json',
|
||||
'plugin/.codex-plugin/plugin.json',
|
||||
'plugin/.mcp.json',
|
||||
|
||||
Reference in New Issue
Block a user