vimd 0.1.5 → 0.1.6

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.
@@ -1 +1 @@
1
- {"version":3,"file":"dev.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/dev.ts"],"names":[],"mappings":"AAYA,UAAU,UAAU;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,wBAAsB,UAAU,CAC9B,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,UAAU,GAClB,OAAO,CAAC,IAAI,CAAC,CAmGf"}
1
+ {"version":3,"file":"dev.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/dev.ts"],"names":[],"mappings":"AAWA,UAAU,UAAU;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,wBAAsB,UAAU,CAC9B,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,UAAU,GAClB,OAAO,CAAC,IAAI,CAAC,CAwGf"}
@@ -6,7 +6,6 @@ import { LiveServer } from '../../core/server.js';
6
6
  import { PandocDetector } from '../../core/pandoc-detector.js';
7
7
  import { Logger } from '../../utils/logger.js';
8
8
  import { ProcessManager } from '../../utils/process-manager.js';
9
- import { TempManager } from '../../utils/temp-manager.js';
10
9
  import * as path from 'path';
11
10
  import fs from 'fs-extra';
12
11
  export async function devCommand(filePath, options) {
@@ -34,9 +33,11 @@ export async function devCommand(filePath, options) {
34
33
  Logger.error(`File not found: ${filePath}`);
35
34
  process.exit(1);
36
35
  }
37
- // 4. Prepare output directory in system temp
38
- const outputDir = await TempManager.createSessionDir();
39
- const htmlPath = path.join(outputDir, path.basename(filePath, path.extname(filePath)) + '.html');
36
+ // 4. Prepare output HTML in source directory
37
+ const sourceDir = path.dirname(absolutePath);
38
+ const basename = path.basename(filePath, path.extname(filePath));
39
+ const htmlFileName = `vimd-preview-${basename}.html`;
40
+ const htmlPath = path.join(sourceDir, htmlFileName);
40
41
  // 5. Prepare converter
41
42
  const converter = new MarkdownConverter({
42
43
  theme: config.theme,
@@ -49,12 +50,12 @@ export async function devCommand(filePath, options) {
49
50
  const html = await converter.convertWithTemplate(absolutePath);
50
51
  await converter.writeHTML(html, htmlPath);
51
52
  Logger.success('Conversion complete');
52
- // 7. Start live server
53
+ // 7. Start live server from source directory
53
54
  const server = new LiveServer({
54
55
  port: config.port,
55
56
  host: config.host,
56
57
  open: config.open,
57
- root: outputDir,
58
+ root: sourceDir,
58
59
  });
59
60
  await server.start(htmlPath);
60
61
  Logger.info(`Watching: ${filePath}`);
@@ -76,12 +77,19 @@ export async function devCommand(filePath, options) {
76
77
  }
77
78
  });
78
79
  watcher.start();
79
- // 9. Register cleanup
80
+ // 9. Register cleanup - remove generated HTML file
80
81
  ProcessManager.onExit(async () => {
81
82
  Logger.info('Shutting down...');
82
83
  await watcher.stop();
83
84
  await server.stop();
84
- await TempManager.removeSessionDir(outputDir);
85
+ // Remove the generated preview HTML file
86
+ try {
87
+ await fs.remove(htmlPath);
88
+ Logger.info(`Removed: ${htmlFileName}`);
89
+ }
90
+ catch {
91
+ // Ignore errors when removing file
92
+ }
85
93
  Logger.info('Cleanup complete');
86
94
  });
87
95
  }
@@ -10,7 +10,7 @@ export const DEFAULT_CONFIG = {
10
10
  },
11
11
  watch: {
12
12
  ignored: ['node_modules/**', '.git/**', 'dist/**'],
13
- debounce: 500,
13
+ debounce: 100,
14
14
  },
15
15
  build: {
16
16
  inlineCSS: false,
@@ -17,7 +17,7 @@ export class LiveServer {
17
17
  root: root,
18
18
  file: file,
19
19
  open: false, // manually open
20
- wait: 100,
20
+ wait: 50,
21
21
  logLevel: 0, // silent
22
22
  watch: [root], // explicitly watch the root directory
23
23
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vimd",
3
- "version": "0.1.5",
3
+ "version": "0.1.6",
4
4
  "description": "Real-time Markdown preview tool with pandoc (view markdown)",
5
5
  "type": "module",
6
6
  "keywords": [