mirror of
https://github.com/lossless-group/perplexed-plugin.git
synced 2026-07-22 17:00:32 +00:00
- Split monolithic main.ts into modular services and modals
- Created separate service classes: PerplexityService,
PerplexicaService, LMStudioService
- Created modular modal classes: PerplexityModal, PerplexicaModal,
LMStudioModal, URLUpdateModal
- Deleted unused legacy files: CitationModal.ts, citationService.ts,
cleanReferencesSectionService.ts
## New Features
- Added ArticleGeneratorModal for one-page article generation with
predefined prompts
- Implemented intelligent image placement with [IMAGE n:
description] markers
- Added auto-scrolling during streaming responses for better
UX
- Created full callout formatting for query blocks with
multi-line support
## UI/UX Improvements
- Moved all inline styles to dedicated CSS files for
better maintainability
- Created modular CSS structure: perplexity-modal.css,
article-generator-modal.css, etc.
- Added proper spacing and padding to text inputs
across all modals
- Fixed sources placement to appear after last
non-empty line (no more huge gaps)
- Enhanced modal layouts with better visual
hierarchy
## Build System
- Updated esbuild.config.mjs to properly bundle
CSS files
- Created src/styles/main.css as CSS entry
point
- Implemented proper CSS build process with
minification support
## Bug Fixes
- Fixed TypeScript errors from unused
imports and parameters
- Resolved streaming scroll issues with
proper cursor tracking
- Fixed multi-line query formatting in
callout blocks
- Corrected sources insertion logic
for both streaming and
non-streaming responses
## Code Quality
- Improved separation of concerns
with service/modal architecture
- Enhanced maintainability with
modular CSS structure
- Added comprehensive error
handling and logging
- Implemented consistent
coding patterns across all
services
## Technical Details
- Services now handle API
calls, streaming, and
response processing
- Modals focus purely on
UI and user
interaction
- CSS uses Obsidian's
design system
variables for
theming
- All modals support
both streaming and
non-streaming
modes
- Image placement
supports both
inline markers
and fallback
sections
Breaking
Changes: None
Migration:
Existing
functionality
preserved,
enhanced with
new features
68 lines
1.5 KiB
JavaScript
68 lines
1.5 KiB
JavaScript
import esbuild from 'esbuild';
|
|
import process from 'node:process';
|
|
import builtins from 'builtin-modules';
|
|
|
|
const banner = `/*
|
|
* Content Farm Plugin for Obsidian
|
|
* Generated: ${new Date().toISOString()}
|
|
* Build: ${process.env.NODE_ENV || 'development'}
|
|
*/`;
|
|
|
|
const isProduction = process.argv[2] === 'production' || process.env.NODE_ENV === 'production';
|
|
|
|
const 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
|
|
];
|
|
|
|
// First, build the CSS file
|
|
await esbuild.build({
|
|
entryPoints: ['src/styles/main.css'],
|
|
bundle: true,
|
|
minify: isProduction,
|
|
outfile: 'styles.css',
|
|
loader: { '.css': 'css' },
|
|
});
|
|
|
|
const context = await esbuild.context({
|
|
banner: {
|
|
js: banner,
|
|
},
|
|
entryPoints: ['main.ts'],
|
|
bundle: true,
|
|
external: [...external, './styles.css'],
|
|
format: 'cjs',
|
|
platform: 'node',
|
|
target: 'es2022',
|
|
treeShaking: true,
|
|
sourcemap: !isProduction ? 'inline' : false,
|
|
minify: isProduction,
|
|
define: {
|
|
'process.env.NODE_ENV': `"${isProduction ? 'production' : 'development'}"`,
|
|
},
|
|
logLevel: 'info',
|
|
outfile: 'main.js',
|
|
loader: { '.css': 'text' },
|
|
});
|
|
|
|
if (isProduction) {
|
|
// Build only for production
|
|
await context.rebuild();
|
|
process.exit(0);
|
|
} else {
|
|
// Enable watch mode for development
|
|
await context.watch();
|
|
console.log('Watching for changes...');
|
|
}
|