vimd 0.1.0
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.
- package/LICENSE +21 -0
- package/README.md +270 -0
- package/dist/cli/commands/build.d.ts +7 -0
- package/dist/cli/commands/build.d.ts.map +1 -0
- package/dist/cli/commands/build.js +54 -0
- package/dist/cli/commands/config.d.ts +6 -0
- package/dist/cli/commands/config.d.ts.map +1 -0
- package/dist/cli/commands/config.js +117 -0
- package/dist/cli/commands/dev.d.ts +8 -0
- package/dist/cli/commands/dev.d.ts.map +1 -0
- package/dist/cli/commands/dev.js +95 -0
- package/dist/cli/commands/theme.d.ts +2 -0
- package/dist/cli/commands/theme.d.ts.map +1 -0
- package/dist/cli/commands/theme.js +46 -0
- package/dist/cli/index.d.ts +3 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +38 -0
- package/dist/cli/setup.d.ts +2 -0
- package/dist/cli/setup.d.ts.map +1 -0
- package/dist/cli/setup.js +50 -0
- package/dist/config/defaults.d.ts +3 -0
- package/dist/config/defaults.d.ts.map +1 -0
- package/dist/config/defaults.js +19 -0
- package/dist/config/loader.d.ts +9 -0
- package/dist/config/loader.d.ts.map +1 -0
- package/dist/config/loader.js +78 -0
- package/dist/config/types.d.ts +47 -0
- package/dist/config/types.d.ts.map +1 -0
- package/dist/config/types.js +4 -0
- package/dist/config/validator.d.ts +11 -0
- package/dist/config/validator.d.ts.map +1 -0
- package/dist/config/validator.js +38 -0
- package/dist/core/converter.d.ts +10 -0
- package/dist/core/converter.d.ts.map +1 -0
- package/dist/core/converter.js +81 -0
- package/dist/core/pandoc-detector.d.ts +8 -0
- package/dist/core/pandoc-detector.d.ts.map +1 -0
- package/dist/core/pandoc-detector.js +70 -0
- package/dist/core/server.d.ts +11 -0
- package/dist/core/server.d.ts.map +1 -0
- package/dist/core/server.js +57 -0
- package/dist/core/watcher.d.ts +16 -0
- package/dist/core/watcher.d.ts.map +1 -0
- package/dist/core/watcher.js +44 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +18 -0
- package/dist/templates/.gitkeep +0 -0
- package/dist/templates/default.html +22 -0
- package/dist/templates/standalone.html +31 -0
- package/dist/themes/index.d.ts +7 -0
- package/dist/themes/index.d.ts.map +1 -0
- package/dist/themes/index.js +29 -0
- package/dist/themes/registry.d.ts +4 -0
- package/dist/themes/registry.d.ts.map +1 -0
- package/dist/themes/registry.js +40 -0
- package/dist/themes/styles/.gitkeep +0 -0
- package/dist/themes/styles/academic.css +68 -0
- package/dist/themes/styles/dark.css +54 -0
- package/dist/themes/styles/github.css +1 -0
- package/dist/themes/styles/minimal.css +35 -0
- package/dist/themes/styles/technical.css +84 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +2 -0
- package/dist/utils/logger.d.ts +7 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +16 -0
- package/dist/utils/os-detector.d.ts +8 -0
- package/dist/utils/os-detector.d.ts.map +1 -0
- package/dist/utils/os-detector.js +34 -0
- package/dist/utils/path-resolver.d.ts +7 -0
- package/dist/utils/path-resolver.d.ts.map +1 -0
- package/dist/utils/path-resolver.js +26 -0
- package/dist/utils/process-manager.d.ts +12 -0
- package/dist/utils/process-manager.d.ts.map +1 -0
- package/dist/utils/process-manager.js +35 -0
- package/package.json +75 -0
- package/templates/.gitkeep +0 -0
- package/templates/default.html +22 -0
- package/templates/standalone.html +31 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export type { VimdConfig, ThemeInfo } from './config/types.js';
|
|
2
|
+
export { defineConfig } from './config/types.js';
|
|
3
|
+
export { MarkdownConverter } from './core/converter.js';
|
|
4
|
+
export { FileWatcher } from './core/watcher.js';
|
|
5
|
+
export { LiveServer } from './core/server.js';
|
|
6
|
+
export { PandocDetector } from './core/pandoc-detector.js';
|
|
7
|
+
export { ThemeManager } from './themes/index.js';
|
|
8
|
+
export { ConfigLoader } from './config/loader.js';
|
|
9
|
+
export { DEFAULT_CONFIG } from './config/defaults.js';
|
|
10
|
+
export { ConfigValidator } from './config/validator.js';
|
|
11
|
+
export { Logger } from './utils/logger.js';
|
|
12
|
+
export { OSDetector } from './utils/os-detector.js';
|
|
13
|
+
export { PathResolver } from './utils/path-resolver.js';
|
|
14
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,YAAY,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAGjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAG3D,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAGjD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAGxD,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// src/index.ts
|
|
2
|
+
// Public API exports for vimd library
|
|
3
|
+
export { defineConfig } from './config/types.js';
|
|
4
|
+
// ==================== コア機能エクスポート ====================
|
|
5
|
+
export { MarkdownConverter } from './core/converter.js';
|
|
6
|
+
export { FileWatcher } from './core/watcher.js';
|
|
7
|
+
export { LiveServer } from './core/server.js';
|
|
8
|
+
export { PandocDetector } from './core/pandoc-detector.js';
|
|
9
|
+
// ==================== テーマ管理エクスポート ====================
|
|
10
|
+
export { ThemeManager } from './themes/index.js';
|
|
11
|
+
// ==================== 設定管理エクスポート ====================
|
|
12
|
+
export { ConfigLoader } from './config/loader.js';
|
|
13
|
+
export { DEFAULT_CONFIG } from './config/defaults.js';
|
|
14
|
+
export { ConfigValidator } from './config/validator.js';
|
|
15
|
+
// ==================== ユーティリティエクスポート ====================
|
|
16
|
+
export { Logger } from './utils/logger.js';
|
|
17
|
+
export { OSDetector } from './utils/os-detector.js';
|
|
18
|
+
export { PathResolver } from './utils/path-resolver.js';
|
|
File without changes
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="ja">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
|
+
<meta name="generator" content="vimd">
|
|
7
|
+
<title>{{title}}</title>
|
|
8
|
+
<style>
|
|
9
|
+
{{theme_css}}
|
|
10
|
+
</style>
|
|
11
|
+
{{#if custom_css}}
|
|
12
|
+
<style>
|
|
13
|
+
{{custom_css}}
|
|
14
|
+
</style>
|
|
15
|
+
{{/if}}
|
|
16
|
+
</head>
|
|
17
|
+
<body>
|
|
18
|
+
<div class="markdown-body">
|
|
19
|
+
{{content}}
|
|
20
|
+
</div>
|
|
21
|
+
</body>
|
|
22
|
+
</html>
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="ja">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
|
+
<meta name="generator" content="vimd">
|
|
7
|
+
<title>{{title}}</title>
|
|
8
|
+
<style>
|
|
9
|
+
{{theme_css}}
|
|
10
|
+
</style>
|
|
11
|
+
{{#if custom_css}}
|
|
12
|
+
<style>
|
|
13
|
+
{{custom_css}}
|
|
14
|
+
</style>
|
|
15
|
+
{{/if}}
|
|
16
|
+
</head>
|
|
17
|
+
<body>
|
|
18
|
+
<div class="markdown-body">
|
|
19
|
+
{{content}}
|
|
20
|
+
</div>
|
|
21
|
+
|
|
22
|
+
<!-- vimd metadata -->
|
|
23
|
+
<script type="application/json" id="vimd-meta">
|
|
24
|
+
{
|
|
25
|
+
"generated": "{{timestamp}}",
|
|
26
|
+
"theme": "{{theme}}",
|
|
27
|
+
"version": "{{version}}"
|
|
28
|
+
}
|
|
29
|
+
</script>
|
|
30
|
+
</body>
|
|
31
|
+
</html>
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ThemeInfo } from '../config/types.js';
|
|
2
|
+
export declare class ThemeManager {
|
|
3
|
+
static list(): ThemeInfo[];
|
|
4
|
+
static getCSS(themeName: string): Promise<string>;
|
|
5
|
+
static loadCustomCSS(cssPath: string): Promise<string>;
|
|
6
|
+
}
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/themes/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAI/C,qBAAa,YAAY;IACvB,MAAM,CAAC,IAAI,IAAI,SAAS,EAAE;WAIb,MAAM,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;WAiB1C,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;CAQ7D"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { THEMES, getThemeByName } from './registry.js';
|
|
2
|
+
import fs from 'fs-extra';
|
|
3
|
+
export class ThemeManager {
|
|
4
|
+
static list() {
|
|
5
|
+
return THEMES;
|
|
6
|
+
}
|
|
7
|
+
static async getCSS(themeName) {
|
|
8
|
+
const theme = getThemeByName(themeName);
|
|
9
|
+
if (!theme) {
|
|
10
|
+
throw new Error(`Theme not found: ${themeName}`);
|
|
11
|
+
}
|
|
12
|
+
try {
|
|
13
|
+
const css = await fs.readFile(theme.cssPath, 'utf-8');
|
|
14
|
+
return css;
|
|
15
|
+
}
|
|
16
|
+
catch (error) {
|
|
17
|
+
throw new Error(`Failed to load theme CSS for '${themeName}': ${error}`);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
static async loadCustomCSS(cssPath) {
|
|
21
|
+
try {
|
|
22
|
+
const css = await fs.readFile(cssPath, 'utf-8');
|
|
23
|
+
return css;
|
|
24
|
+
}
|
|
25
|
+
catch (error) {
|
|
26
|
+
throw new Error(`Failed to load custom CSS from '${cssPath}': ${error}`);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/themes/registry.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAQ/C,eAAO,MAAM,MAAM,EAAE,SAAS,EA+B7B,CAAC;AAEF,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,CAElE"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import * as path from 'path';
|
|
2
|
+
import { fileURLToPath } from 'url';
|
|
3
|
+
import { dirname } from 'path';
|
|
4
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
5
|
+
const __dirname = dirname(__filename);
|
|
6
|
+
export const THEMES = [
|
|
7
|
+
{
|
|
8
|
+
name: 'github',
|
|
9
|
+
displayName: 'GitHub (Recommended)',
|
|
10
|
+
description: 'GitHub Markdown style with clean design',
|
|
11
|
+
cssPath: path.join(__dirname, 'styles', 'github.css'),
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
name: 'minimal',
|
|
15
|
+
displayName: 'Minimal',
|
|
16
|
+
description: 'Simple white background with minimal decoration',
|
|
17
|
+
cssPath: path.join(__dirname, 'styles', 'minimal.css'),
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
name: 'dark',
|
|
21
|
+
displayName: 'Dark',
|
|
22
|
+
description: 'VS Code inspired dark mode',
|
|
23
|
+
cssPath: path.join(__dirname, 'styles', 'dark.css'),
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
name: 'academic',
|
|
27
|
+
displayName: 'Academic',
|
|
28
|
+
description: 'Paper-style layout for academic writing',
|
|
29
|
+
cssPath: path.join(__dirname, 'styles', 'academic.css'),
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
name: 'technical',
|
|
33
|
+
displayName: 'Technical',
|
|
34
|
+
description: 'API documentation style with sidebar',
|
|
35
|
+
cssPath: path.join(__dirname, 'styles', 'technical.css'),
|
|
36
|
+
},
|
|
37
|
+
];
|
|
38
|
+
export function getThemeByName(name) {
|
|
39
|
+
return THEMES.find((theme) => theme.name === name);
|
|
40
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/* Academic Theme - Paper-style layout */
|
|
2
|
+
body {
|
|
3
|
+
font-family: Georgia, 'Times New Roman', serif;
|
|
4
|
+
line-height: 1.8;
|
|
5
|
+
color: #333;
|
|
6
|
+
background: #fff;
|
|
7
|
+
max-width: 700px;
|
|
8
|
+
margin: 0 auto;
|
|
9
|
+
padding: 3rem;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
h1 {
|
|
13
|
+
font-size: 2em;
|
|
14
|
+
text-align: center;
|
|
15
|
+
margin-bottom: 2em;
|
|
16
|
+
border-bottom: none;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
h2 {
|
|
20
|
+
font-size: 1.5em;
|
|
21
|
+
margin-top: 2em;
|
|
22
|
+
margin-bottom: 0.5em;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
p {
|
|
26
|
+
text-align: justify;
|
|
27
|
+
margin-bottom: 1em;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
code {
|
|
31
|
+
background: #f9f9f9;
|
|
32
|
+
padding: 0.2em 0.4em;
|
|
33
|
+
border: 1px solid #e0e0e0;
|
|
34
|
+
font-family: 'Courier New', monospace;
|
|
35
|
+
font-size: 0.9em;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
pre {
|
|
39
|
+
background: #f9f9f9;
|
|
40
|
+
padding: 1em;
|
|
41
|
+
border: 1px solid #e0e0e0;
|
|
42
|
+
overflow-x: auto;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
blockquote {
|
|
46
|
+
border-left: 3px solid #ccc;
|
|
47
|
+
padding-left: 1em;
|
|
48
|
+
font-style: italic;
|
|
49
|
+
color: #666;
|
|
50
|
+
margin: 1.5em 0;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
table {
|
|
54
|
+
border-collapse: collapse;
|
|
55
|
+
width: 100%;
|
|
56
|
+
margin: 1.5em 0;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
th, td {
|
|
60
|
+
border: 1px solid #ddd;
|
|
61
|
+
padding: 0.5em;
|
|
62
|
+
text-align: left;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
th {
|
|
66
|
+
background: #f5f5f5;
|
|
67
|
+
font-weight: 600;
|
|
68
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/* Dark Theme - VS Code inspired */
|
|
2
|
+
body {
|
|
3
|
+
font-family: 'Fira Code', Consolas, Monaco, monospace;
|
|
4
|
+
line-height: 1.6;
|
|
5
|
+
color: #d4d4d4;
|
|
6
|
+
background: #1e1e1e;
|
|
7
|
+
max-width: 900px;
|
|
8
|
+
margin: 0 auto;
|
|
9
|
+
padding: 2rem;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
h1, h2, h3, h4, h5, h6 {
|
|
13
|
+
color: #569cd6;
|
|
14
|
+
margin-top: 1.5em;
|
|
15
|
+
margin-bottom: 0.5em;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
a {
|
|
19
|
+
color: #569cd6;
|
|
20
|
+
text-decoration: none;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
a:hover {
|
|
24
|
+
text-decoration: underline;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
code {
|
|
28
|
+
background: #252526;
|
|
29
|
+
color: #ce9178;
|
|
30
|
+
padding: 0.2em 0.4em;
|
|
31
|
+
border-radius: 3px;
|
|
32
|
+
font-family: 'Fira Code', monospace;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
pre {
|
|
36
|
+
background: #252526;
|
|
37
|
+
padding: 1em;
|
|
38
|
+
border-radius: 5px;
|
|
39
|
+
overflow-x: auto;
|
|
40
|
+
border: 1px solid #333;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
pre code {
|
|
44
|
+
background: none;
|
|
45
|
+
color: #d4d4d4;
|
|
46
|
+
padding: 0;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
blockquote {
|
|
50
|
+
border-left: 4px solid #569cd6;
|
|
51
|
+
padding-left: 1em;
|
|
52
|
+
color: #b5b5b5;
|
|
53
|
+
margin-left: 0;
|
|
54
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
body { color: black; }
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/* Minimal Theme - Simple and clean */
|
|
2
|
+
body {
|
|
3
|
+
font-family: system-ui, -apple-system, sans-serif;
|
|
4
|
+
line-height: 1.6;
|
|
5
|
+
color: #000;
|
|
6
|
+
background: #fff;
|
|
7
|
+
max-width: 800px;
|
|
8
|
+
margin: 0 auto;
|
|
9
|
+
padding: 2rem;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
h1, h2, h3, h4, h5, h6 {
|
|
13
|
+
margin-top: 1.5em;
|
|
14
|
+
margin-bottom: 0.5em;
|
|
15
|
+
font-weight: 600;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
code {
|
|
19
|
+
background: #f5f5f5;
|
|
20
|
+
padding: 0.2em 0.4em;
|
|
21
|
+
border-radius: 3px;
|
|
22
|
+
font-family: monospace;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
pre {
|
|
26
|
+
background: #f5f5f5;
|
|
27
|
+
padding: 1em;
|
|
28
|
+
border-radius: 5px;
|
|
29
|
+
overflow-x: auto;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
pre code {
|
|
33
|
+
background: none;
|
|
34
|
+
padding: 0;
|
|
35
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/* Technical Theme - API documentation style */
|
|
2
|
+
body {
|
|
3
|
+
font-family: 'SF Mono', 'Roboto Mono', monospace;
|
|
4
|
+
line-height: 1.6;
|
|
5
|
+
color: #2c3e50;
|
|
6
|
+
background: #fafafa;
|
|
7
|
+
margin: 0;
|
|
8
|
+
padding: 0;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.markdown-body {
|
|
12
|
+
max-width: 1200px;
|
|
13
|
+
margin: 0 auto;
|
|
14
|
+
padding: 2rem;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
h1 {
|
|
18
|
+
font-size: 2.5em;
|
|
19
|
+
color: #34495e;
|
|
20
|
+
border-bottom: 3px solid #3498db;
|
|
21
|
+
padding-bottom: 0.5em;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
h2 {
|
|
25
|
+
font-size: 1.8em;
|
|
26
|
+
color: #34495e;
|
|
27
|
+
margin-top: 2em;
|
|
28
|
+
border-bottom: 2px solid #ecf0f1;
|
|
29
|
+
padding-bottom: 0.3em;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
h3 {
|
|
33
|
+
font-size: 1.3em;
|
|
34
|
+
color: #34495e;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
code {
|
|
38
|
+
background: #f4f4f4;
|
|
39
|
+
color: #e74c3c;
|
|
40
|
+
padding: 0.2em 0.5em;
|
|
41
|
+
border-radius: 3px;
|
|
42
|
+
font-family: 'SF Mono', monospace;
|
|
43
|
+
font-size: 0.95em;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
pre {
|
|
47
|
+
background: #f4f4f4;
|
|
48
|
+
padding: 1.5em;
|
|
49
|
+
border-radius: 5px;
|
|
50
|
+
overflow-x: auto;
|
|
51
|
+
border-left: 4px solid #3498db;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
pre code {
|
|
55
|
+
background: none;
|
|
56
|
+
color: #2c3e50;
|
|
57
|
+
padding: 0;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
a {
|
|
61
|
+
color: #3498db;
|
|
62
|
+
text-decoration: none;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
a:hover {
|
|
66
|
+
text-decoration: underline;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
table {
|
|
70
|
+
border-collapse: collapse;
|
|
71
|
+
width: 100%;
|
|
72
|
+
margin: 1em 0;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
th, td {
|
|
76
|
+
border: 1px solid #ddd;
|
|
77
|
+
padding: 0.8em;
|
|
78
|
+
text-align: left;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
th {
|
|
82
|
+
background: #34495e;
|
|
83
|
+
color: #fff;
|
|
84
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAEA,cAAc,iBAAiB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/utils/logger.ts"],"names":[],"mappings":"AAGA,qBAAa,MAAM;IACjB,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAIlC,MAAM,CAAC,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAIrC,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAIlC,MAAM,CAAC,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;CAGpC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// src/utils/logger.ts
|
|
2
|
+
import chalk from 'chalk';
|
|
3
|
+
export class Logger {
|
|
4
|
+
static info(message) {
|
|
5
|
+
console.log(chalk.blue('ℹ'), message);
|
|
6
|
+
}
|
|
7
|
+
static success(message) {
|
|
8
|
+
console.log(chalk.green('✓'), message);
|
|
9
|
+
}
|
|
10
|
+
static warn(message) {
|
|
11
|
+
console.log(chalk.yellow('⚠'), message);
|
|
12
|
+
}
|
|
13
|
+
static error(message) {
|
|
14
|
+
console.error(chalk.red('✗'), message);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export type OSType = 'macos' | 'linux-debian' | 'linux-redhat' | 'windows';
|
|
2
|
+
export declare class OSDetector {
|
|
3
|
+
static isMac(): boolean;
|
|
4
|
+
static isLinux(): boolean;
|
|
5
|
+
static isWindows(): boolean;
|
|
6
|
+
static detect(): OSType;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=os-detector.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"os-detector.d.ts","sourceRoot":"","sources":["../../src/utils/os-detector.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,MAAM,GAAG,OAAO,GAAG,cAAc,GAAG,cAAc,GAAG,SAAS,CAAC;AAE3E,qBAAa,UAAU;IACrB,MAAM,CAAC,KAAK,IAAI,OAAO;IAIvB,MAAM,CAAC,OAAO,IAAI,OAAO;IAIzB,MAAM,CAAC,SAAS,IAAI,OAAO;IAI3B,MAAM,CAAC,MAAM,IAAI,MAAM;CAuBxB"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// src/utils/os-detector.ts
|
|
2
|
+
import { platform } from 'os';
|
|
3
|
+
import { existsSync } from 'fs';
|
|
4
|
+
export class OSDetector {
|
|
5
|
+
static isMac() {
|
|
6
|
+
return process.platform === 'darwin';
|
|
7
|
+
}
|
|
8
|
+
static isLinux() {
|
|
9
|
+
return process.platform === 'linux';
|
|
10
|
+
}
|
|
11
|
+
static isWindows() {
|
|
12
|
+
return process.platform === 'win32';
|
|
13
|
+
}
|
|
14
|
+
static detect() {
|
|
15
|
+
if (this.isMac()) {
|
|
16
|
+
return 'macos';
|
|
17
|
+
}
|
|
18
|
+
if (this.isWindows()) {
|
|
19
|
+
return 'windows';
|
|
20
|
+
}
|
|
21
|
+
if (this.isLinux()) {
|
|
22
|
+
// Debian系かRedHat系か判定
|
|
23
|
+
if (existsSync('/etc/debian_version')) {
|
|
24
|
+
return 'linux-debian';
|
|
25
|
+
}
|
|
26
|
+
if (existsSync('/etc/redhat-release')) {
|
|
27
|
+
return 'linux-redhat';
|
|
28
|
+
}
|
|
29
|
+
// デフォルトはDebian系として扱う
|
|
30
|
+
return 'linux-debian';
|
|
31
|
+
}
|
|
32
|
+
throw new Error(`Unsupported platform: ${platform()}`);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"path-resolver.d.ts","sourceRoot":"","sources":["../../src/utils/path-resolver.ts"],"names":[],"mappings":"AAIA,qBAAa,YAAY;IACvB,MAAM,CAAC,UAAU,IAAI,MAAM;IAI3B,MAAM,CAAC,YAAY,IAAI,MAAM;IAI7B,MAAM,CAAC,aAAa,IAAI,MAAM;IAI9B,MAAM,CAAC,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;CAcrC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// src/utils/path-resolver.ts
|
|
2
|
+
import { homedir } from 'os';
|
|
3
|
+
import { join, resolve as pathResolve, isAbsolute } from 'path';
|
|
4
|
+
export class PathResolver {
|
|
5
|
+
static getHomeDir() {
|
|
6
|
+
return homedir();
|
|
7
|
+
}
|
|
8
|
+
static getConfigDir() {
|
|
9
|
+
return join(this.getHomeDir(), '.vimd');
|
|
10
|
+
}
|
|
11
|
+
static getConfigPath() {
|
|
12
|
+
return join(this.getConfigDir(), 'config.js');
|
|
13
|
+
}
|
|
14
|
+
static resolve(path) {
|
|
15
|
+
// ~ または ~/ で始まる場合はホームディレクトリに展開
|
|
16
|
+
if (path.startsWith('~/') || path === '~') {
|
|
17
|
+
return join(this.getHomeDir(), path.slice(2));
|
|
18
|
+
}
|
|
19
|
+
// 既に絶対パスの場合はそのまま返す
|
|
20
|
+
if (isAbsolute(path)) {
|
|
21
|
+
return path;
|
|
22
|
+
}
|
|
23
|
+
// 相対パスを絶対パスに変換
|
|
24
|
+
return pathResolve(process.cwd(), path);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
type ExitHandler = () => void | Promise<void>;
|
|
2
|
+
export declare class ProcessManager {
|
|
3
|
+
private static handlers;
|
|
4
|
+
private static initialized;
|
|
5
|
+
private static init;
|
|
6
|
+
static onExit(handler: ExitHandler): void;
|
|
7
|
+
private static executeHandlers;
|
|
8
|
+
static cleanup(): Promise<void>;
|
|
9
|
+
static reset(): void;
|
|
10
|
+
}
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=process-manager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"process-manager.d.ts","sourceRoot":"","sources":["../../src/utils/process-manager.ts"],"names":[],"mappings":"AAEA,KAAK,WAAW,GAAG,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AAE9C,qBAAa,cAAc;IACzB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAqB;IAC5C,OAAO,CAAC,MAAM,CAAC,WAAW,CAAS;IAEnC,OAAO,CAAC,MAAM,CAAC,IAAI;IAgBnB,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI;mBAKpB,eAAe;WAMvB,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAKrC,MAAM,CAAC,KAAK,IAAI,IAAI;CAIrB"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// src/utils/process-manager.ts
|
|
2
|
+
export class ProcessManager {
|
|
3
|
+
static init() {
|
|
4
|
+
if (this.initialized)
|
|
5
|
+
return;
|
|
6
|
+
process.on('SIGINT', async () => {
|
|
7
|
+
await this.executeHandlers();
|
|
8
|
+
process.exit(0);
|
|
9
|
+
});
|
|
10
|
+
process.on('SIGTERM', async () => {
|
|
11
|
+
await this.executeHandlers();
|
|
12
|
+
process.exit(0);
|
|
13
|
+
});
|
|
14
|
+
this.initialized = true;
|
|
15
|
+
}
|
|
16
|
+
static onExit(handler) {
|
|
17
|
+
this.init();
|
|
18
|
+
this.handlers.push(handler);
|
|
19
|
+
}
|
|
20
|
+
static async executeHandlers() {
|
|
21
|
+
for (const handler of this.handlers) {
|
|
22
|
+
await handler();
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
static async cleanup() {
|
|
26
|
+
this.handlers = [];
|
|
27
|
+
}
|
|
28
|
+
// テスト用: ハンドラをリセット
|
|
29
|
+
static reset() {
|
|
30
|
+
this.handlers = [];
|
|
31
|
+
this.initialized = false;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
ProcessManager.handlers = [];
|
|
35
|
+
ProcessManager.initialized = false;
|