andy-stack_vaultkeeper-ai/esbuild.config.mjs
Andrew Beal 7efdac24cf Remove deprecated CSS files and enhance markdown processing service
- Deleted highlight-default.min.css, katex.min.css, and markdown.css as they are no longer needed.
- Implemented StreamingMarkdownService for improved markdown processing with support for math and syntax highlighting.
- Added StreamingService for handling streaming requests to the Gemini API with error handling and chunk parsing.
- Introduced styles_old.css for enhanced code block styling and better readability.
2025-09-26 20:48:05 +01:00

83 lines
No EOL
1.9 KiB
JavaScript

import esbuild from "esbuild";
import process from "process";
import builtins from "builtin-modules";
import { copyFileSync, mkdirSync, existsSync, readdirSync, statSync } from "fs";
import path, { join } from "path";
import esbuildSvelte from 'esbuild-svelte';
import { sveltePreprocess } from 'svelte-preprocess';
const banner =
`/*
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
if you want to view the source, please visit the github repository of this plugin
*/
`;
const prod = (process.argv[2] === "production");
// Function to copy directory recursively
function copyDir(src, dest) {
if (!existsSync(dest)) {
mkdirSync(dest, { recursive: true });
}
const files = readdirSync(src);
for (const file of files) {
const srcPath = join(src, file);
const destPath = join(dest, file);
if (statSync(srcPath).isDirectory()) {
copyDir(srcPath, destPath);
} else {
copyFileSync(srcPath, destPath);
console.log(`📁 Copied: ${srcPath}${destPath}`);
}
}
}
const buildOptions = {
plugins: [
esbuildSvelte({
compilerOptions: { css: 'injected' },
preprocess: sveltePreprocess(),
}),
],
banner: {
js: banner,
},
entryPoints: ["main.ts"],
bundle: true,
external: [
"obsidian",
"electron",
"@codemirror/autocomplete",
"@codemirror/collab",
"@codemirror/commands",
"@codemirror/language",
"@codemirror/lint",
"@codemirror/search",
"@codemirror/state",
"@codemirror/view",
"@lezer/common",
"@lezer/highlight",
"@lezer/lr",
...builtins],
format: "cjs",
target: "es2018",
logLevel: "info",
sourcemap: prod ? false : "inline",
treeShaking: true,
outfile: "main.js",
minify: prod,
};
if (prod) {
await esbuild.build(buildOptions);
console.log("✅ Production build complete!");
} else {
const ctx = await esbuild.context(buildOptions);
await ctx.watch();
console.log("👀 Watching for changes...");
}