@tnotesjs/core 0.1.24 → 0.1.25
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/dist/{chunk-BSTQOJVE.js → chunk-4KG6RXFS.js} +113 -130
- package/dist/{chunk-O4DCXHOV.js → chunk-AGSL3VZE.js} +1 -4
- package/dist/cli/index.js +162 -173
- package/dist/index.js +1 -1
- package/dist/vitepress/config/index.js +6 -8
- package/package.json +4 -1
- package/types/config.ts +1 -1
- package/types/index.ts +1 -1
- package/types/note.ts +1 -1
- package/vitepress/assets/icons/index.ts +1 -1
- package/vitepress/components/BilibiliOutsidePlayer/BilibiliOutsidePlayer.vue +4 -0
- package/vitepress/components/CodeBlockFullscreen/CodeBlockFullscreen.vue +4 -0
- package/vitepress/components/CodeBlockFullscreen/index.ts +8 -0
- package/vitepress/components/CodeBlockFullscreen/styles.css +4 -0
- package/vitepress/components/Discussions/Discussions.vue +4 -0
- package/vitepress/components/EnWordList/EnWordList.vue +4 -0
- package/vitepress/components/EnWordList/RightClickMenu.vue +4 -0
- package/vitepress/components/Footprints/Footprints.vue +4 -0
- package/vitepress/components/Layout/AboutModal.vue +4 -0
- package/vitepress/components/Layout/AboutPanel.vue +4 -0
- package/vitepress/components/Layout/ContentCollapse.vue +4 -0
- package/vitepress/components/Layout/CustomSidebar.vue +4 -0
- package/vitepress/components/Layout/DocBeforeControls.vue +4 -0
- package/vitepress/components/Layout/DocFooter.vue +4 -0
- package/vitepress/components/Layout/ImagePreview.vue +4 -0
- package/vitepress/components/Layout/Layout.vue +4 -0
- package/vitepress/components/Layout/NavBarSettingsTrigger.vue +4 -0
- package/vitepress/components/Layout/NoteStatus.vue +4 -0
- package/vitepress/components/Layout/SidebarItems.vue +4 -0
- package/vitepress/components/Layout/SidebarNavBefore.vue +4 -0
- package/vitepress/components/Layout/SidebarResizeHandle.vue +5 -1
- package/vitepress/components/Layout/Swiper.vue +4 -0
- package/vitepress/components/Layout/ToggleFullContent.vue +4 -0
- package/vitepress/components/Layout/ToggleSidebar.vue +4 -1
- package/vitepress/components/Layout/composables/useCollapseControl.ts +6 -0
- package/vitepress/components/Layout/composables/useNoteConfig.ts +7 -0
- package/vitepress/components/Layout/composables/useNoteSave.ts +4 -0
- package/vitepress/components/Layout/composables/useNoteValidation.ts +8 -0
- package/vitepress/components/Layout/composables/useRedirect.ts +7 -0
- package/vitepress/components/Layout/composables/useRenameOverlay.ts +3 -0
- package/vitepress/components/Layout/composables/useRenameRedirect.ts +3 -0
- package/vitepress/components/Layout/composables/useSidebarLayout.ts +6 -0
- package/vitepress/components/Layout/composables/useVSCodeIntegration.ts +6 -0
- package/vitepress/components/Layout/homeReadme.data.ts +3 -1
- package/vitepress/components/LoadingPage/LoadingPage.vue +4 -0
- package/vitepress/components/MarkMap/MarkMap.vue +4 -0
- package/vitepress/components/Mermaid/Mermaid.vue +6 -0
- package/vitepress/components/NotesTable/NotesTable.vue +4 -0
- package/vitepress/components/Settings/Settings.vue +6 -0
- package/vitepress/components/Settings/SettingsDialog.vue +6 -0
- package/vitepress/components/Settings/composables/useSettingsDialog.ts +3 -0
- package/vitepress/components/SidebarCard/MindMapView.vue +4 -0
- package/vitepress/components/SidebarCard/NotesTrendChart.vue +4 -0
- package/vitepress/components/SidebarCard/SidebarCard.vue +4 -0
- package/vitepress/components/Tooltip/Tooltip.vue +6 -0
- package/vitepress/components/constants.ts +3 -0
- package/vitepress/components/notesConfig.data.ts +7 -1
- package/vitepress/components/sidebar.data.ts +1 -1
- package/vitepress/components/tnotes-config.data.ts +13 -8
- package/vitepress/components/utils.ts +6 -0
- package/vitepress/config/index.ts +5 -13
- package/vitepress/configs/constants.ts +1 -0
- package/vitepress/configs/head.config.ts +1 -0
- package/vitepress/configs/index.ts +1 -0
- package/vitepress/configs/markdown.config.ts +1 -0
- package/vitepress/configs/theme.config.ts +1 -0
- package/vitepress/plugins/buildProgressPlugin.ts +1 -1
- package/vitepress/plugins/fileWatcherBridgePlugin.ts +2 -1
- package/vitepress/plugins/getNoteByConfigIdPlugin.ts +2 -1
- package/vitepress/plugins/renameNotePlugin.ts +2 -1
- package/vitepress/plugins/sidebarStructurePlugin.ts +3 -2
- package/vitepress/plugins/updateConfigPlugin.ts +2 -1
- package/vitepress/theme/index.ts +1 -4
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ConfigManager,
|
|
3
3
|
getConfigManager
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-AGSL3VZE.js";
|
|
5
5
|
|
|
6
6
|
// utils/errorHandler.ts
|
|
7
7
|
var TNotesError = class _TNotesError extends Error {
|
|
@@ -95,10 +95,6 @@ var createError = {
|
|
|
95
95
|
|
|
96
96
|
// utils/logger.ts
|
|
97
97
|
var Logger = class _Logger {
|
|
98
|
-
level;
|
|
99
|
-
prefix;
|
|
100
|
-
timestamp;
|
|
101
|
-
colors;
|
|
102
98
|
constructor(config2 = {}) {
|
|
103
99
|
this.level = config2.level ?? 1 /* INFO */;
|
|
104
100
|
this.prefix = config2.prefix ?? "";
|
|
@@ -624,9 +620,10 @@ var REPO_NOTES_URL = `https://github.com/${author}/${repoName}/tree/main/notes`;
|
|
|
624
620
|
|
|
625
621
|
// core/NoteManager.ts
|
|
626
622
|
var NoteManager = class _NoteManager {
|
|
627
|
-
static
|
|
628
|
-
|
|
629
|
-
|
|
623
|
+
static {
|
|
624
|
+
/** 笔记索引正则:4 位数字开头,后接小数点 */
|
|
625
|
+
this.NOTE_INDEX_REGEX = /^(\d{4})\./;
|
|
626
|
+
}
|
|
630
627
|
constructor() {
|
|
631
628
|
}
|
|
632
629
|
/**
|
|
@@ -778,30 +775,36 @@ var NoteManager = class _NoteManager {
|
|
|
778
775
|
}
|
|
779
776
|
return indexMap;
|
|
780
777
|
}
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
778
|
+
static {
|
|
779
|
+
/** 配置字段顺序 */
|
|
780
|
+
this.FIELD_ORDER = [
|
|
781
|
+
"bilibili",
|
|
782
|
+
"tnotes",
|
|
783
|
+
"yuque",
|
|
784
|
+
"done",
|
|
785
|
+
"category",
|
|
786
|
+
"enableDiscussions",
|
|
787
|
+
"description",
|
|
788
|
+
"id",
|
|
789
|
+
"created_at",
|
|
790
|
+
"updated_at"
|
|
791
|
+
];
|
|
792
|
+
}
|
|
793
|
+
static {
|
|
794
|
+
/** 默认配置字段 */
|
|
795
|
+
this.DEFAULT_CONFIG_FIELDS = {
|
|
796
|
+
bilibili: [],
|
|
797
|
+
tnotes: [],
|
|
798
|
+
yuque: [],
|
|
799
|
+
done: false,
|
|
800
|
+
enableDiscussions: false,
|
|
801
|
+
description: ""
|
|
802
|
+
};
|
|
803
|
+
}
|
|
804
|
+
static {
|
|
805
|
+
/** 必需字段(不能缺失) */
|
|
806
|
+
this.REQUIRED_FIELDS = ["id"];
|
|
807
|
+
}
|
|
805
808
|
/**
|
|
806
809
|
* 验证并修复配置文件
|
|
807
810
|
* @param configPath - 配置文件路径
|
|
@@ -1143,14 +1146,16 @@ var COMMAND_OPTIONS = {
|
|
|
1143
1146
|
// core/NoteIndexCache.ts
|
|
1144
1147
|
import { join as join2 } from "path";
|
|
1145
1148
|
var NoteIndexCache = class _NoteIndexCache {
|
|
1146
|
-
static instance = null;
|
|
1147
|
-
/** noteIndex -> NoteIndexItem 的映射 */
|
|
1148
|
-
byNoteIndex = /* @__PURE__ */ new Map();
|
|
1149
|
-
/** configId (UUID) -> noteIndex 的映射,用于快速反向查询 */
|
|
1150
|
-
byConfigId = /* @__PURE__ */ new Map();
|
|
1151
|
-
/** 是否已完成初始化 */
|
|
1152
|
-
_initialized = false;
|
|
1153
1149
|
constructor() {
|
|
1150
|
+
/** noteIndex -> NoteIndexItem 的映射 */
|
|
1151
|
+
this.byNoteIndex = /* @__PURE__ */ new Map();
|
|
1152
|
+
/** configId (UUID) -> noteIndex 的映射,用于快速反向查询 */
|
|
1153
|
+
this.byConfigId = /* @__PURE__ */ new Map();
|
|
1154
|
+
/** 是否已完成初始化 */
|
|
1155
|
+
this._initialized = false;
|
|
1156
|
+
}
|
|
1157
|
+
static {
|
|
1158
|
+
this.instance = null;
|
|
1154
1159
|
}
|
|
1155
1160
|
/**
|
|
1156
1161
|
* 获取单例实例
|
|
@@ -1444,8 +1449,6 @@ var TocGenerator = class {
|
|
|
1444
1449
|
|
|
1445
1450
|
// core/ReadmeGenerator.ts
|
|
1446
1451
|
var ReadmeGenerator = class {
|
|
1447
|
-
tocGenerator;
|
|
1448
|
-
configManager;
|
|
1449
1452
|
constructor() {
|
|
1450
1453
|
this.tocGenerator = new TocGenerator();
|
|
1451
1454
|
this.configManager = ConfigManager.getInstance();
|
|
@@ -1582,11 +1585,6 @@ var ReadmeGenerator = class {
|
|
|
1582
1585
|
|
|
1583
1586
|
// services/readme/service.ts
|
|
1584
1587
|
var ReadmeService = class _ReadmeService {
|
|
1585
|
-
static instance;
|
|
1586
|
-
noteManager;
|
|
1587
|
-
readmeGenerator;
|
|
1588
|
-
configManager;
|
|
1589
|
-
noteIndexCache;
|
|
1590
1588
|
constructor() {
|
|
1591
1589
|
this.noteManager = NoteManager.getInstance();
|
|
1592
1590
|
this.readmeGenerator = new ReadmeGenerator();
|
|
@@ -2138,11 +2136,8 @@ var NEW_NOTES_README_MD_TEMPLATE = `
|
|
|
2138
2136
|
- todo
|
|
2139
2137
|
`;
|
|
2140
2138
|
var NoteService = class _NoteService {
|
|
2141
|
-
static instance;
|
|
2142
|
-
noteManager;
|
|
2143
|
-
noteIndexCache;
|
|
2144
|
-
ignoredConfigPaths = /* @__PURE__ */ new Set();
|
|
2145
2139
|
constructor() {
|
|
2140
|
+
this.ignoredConfigPaths = /* @__PURE__ */ new Set();
|
|
2146
2141
|
this.noteManager = NoteManager.getInstance();
|
|
2147
2142
|
this.noteIndexCache = NoteIndexCache.getInstance();
|
|
2148
2143
|
}
|
|
@@ -2434,25 +2429,21 @@ var DEFAULT_BATCH_BUFFER_MS = 2e3;
|
|
|
2434
2429
|
var EventScheduler = class {
|
|
2435
2430
|
constructor(config2) {
|
|
2436
2431
|
this.config = config2;
|
|
2432
|
+
/** 待处理的文件变更事件队列 */
|
|
2433
|
+
this.pendingEvents = /* @__PURE__ */ new Map();
|
|
2434
|
+
/** 防抖定时器 */
|
|
2435
|
+
this.updateTimer = null;
|
|
2436
|
+
/** 批量更新恢复定时器 */
|
|
2437
|
+
this.batchResumeTimer = null;
|
|
2438
|
+
/** 记录最近的变更时间戳 */
|
|
2439
|
+
this.recentChanges = [];
|
|
2440
|
+
/** 标记是否正在更新,避免循环触发 - 类似一把更新行为锁 */
|
|
2441
|
+
this.isUpdating = false;
|
|
2437
2442
|
this.debounceMs = config2.debounceMs ?? DEFAULT_DEBOUNCE_MS;
|
|
2438
2443
|
this.batchWindowMs = config2.batchWindowMs ?? DEFAULT_BATCH_WINDOW_MS;
|
|
2439
2444
|
this.batchThreshold = config2.batchThreshold ?? DEFAULT_BATCH_THRESHOLD;
|
|
2440
2445
|
this.batchBufferMs = config2.batchBufferMs ?? DEFAULT_BATCH_BUFFER_MS;
|
|
2441
2446
|
}
|
|
2442
|
-
/** 待处理的文件变更事件队列 */
|
|
2443
|
-
pendingEvents = /* @__PURE__ */ new Map();
|
|
2444
|
-
/** 防抖定时器 */
|
|
2445
|
-
updateTimer = null;
|
|
2446
|
-
/** 批量更新恢复定时器 */
|
|
2447
|
-
batchResumeTimer = null;
|
|
2448
|
-
/** 记录最近的变更时间戳 */
|
|
2449
|
-
recentChanges = [];
|
|
2450
|
-
/** 标记是否正在更新,避免循环触发 - 类似一把更新行为锁 */
|
|
2451
|
-
isUpdating = false;
|
|
2452
|
-
debounceMs;
|
|
2453
|
-
batchWindowMs;
|
|
2454
|
-
batchThreshold;
|
|
2455
|
-
batchBufferMs;
|
|
2456
2447
|
/**
|
|
2457
2448
|
* 设置更新状态锁,用于防止在执行耗时更新操作时被新的文件变更事件打断
|
|
2458
2449
|
*
|
|
@@ -2574,9 +2565,9 @@ var UPDATE_UNLOCK_DELAY_MS = 500;
|
|
|
2574
2565
|
var FolderChangeHandler = class {
|
|
2575
2566
|
constructor(config2) {
|
|
2576
2567
|
this.config = config2;
|
|
2568
|
+
/** 活跃的定时器 ID 集合,用于统一清理 */
|
|
2569
|
+
this.activeTimers = /* @__PURE__ */ new Set();
|
|
2577
2570
|
}
|
|
2578
|
-
/** 活跃的定时器 ID 集合,用于统一清理 */
|
|
2579
|
-
activeTimers = /* @__PURE__ */ new Set();
|
|
2580
2571
|
/**
|
|
2581
2572
|
* 清理所有活跃定时器,释放资源
|
|
2582
2573
|
*
|
|
@@ -2773,9 +2764,9 @@ import { basename, dirname, join as join5, sep } from "path";
|
|
|
2773
2764
|
var FsWatcherAdapter = class {
|
|
2774
2765
|
constructor(config2) {
|
|
2775
2766
|
this.config = config2;
|
|
2767
|
+
/** 文件系统监听器实例 */
|
|
2768
|
+
this.watcher = null;
|
|
2776
2769
|
}
|
|
2777
|
-
/** 文件系统监听器实例 */
|
|
2778
|
-
watcher = null;
|
|
2779
2770
|
start() {
|
|
2780
2771
|
const { logger: logger2 } = this.config;
|
|
2781
2772
|
if (this.watcher) {
|
|
@@ -2893,11 +2884,11 @@ var FOLDER_RENAME_DETECT_WINDOW_MS = 500;
|
|
|
2893
2884
|
var RenameDetector = class {
|
|
2894
2885
|
constructor(config2) {
|
|
2895
2886
|
this.config = config2;
|
|
2887
|
+
/** 待处理的文件夹重命名 */
|
|
2888
|
+
this.pendingFolderRename = null;
|
|
2889
|
+
/** 文件夹重命名检测定时器 */
|
|
2890
|
+
this.folderRenameTimer = null;
|
|
2896
2891
|
}
|
|
2897
|
-
/** 待处理的文件夹重命名 */
|
|
2898
|
-
pendingFolderRename = null;
|
|
2899
|
-
/** 文件夹重命名检测定时器 */
|
|
2900
|
-
folderRenameTimer = null;
|
|
2901
2892
|
handleFsRename(folderName) {
|
|
2902
2893
|
const { notesDir, dirCache, logger: logger2, onDelete, onRename } = this.config;
|
|
2903
2894
|
const folderPath = join6(notesDir, folderName);
|
|
@@ -2962,13 +2953,13 @@ import { join as join7 } from "path";
|
|
|
2962
2953
|
var WatchState = class {
|
|
2963
2954
|
constructor(config2) {
|
|
2964
2955
|
this.config = config2;
|
|
2956
|
+
/** 文件哈希缓存 */
|
|
2957
|
+
this.fileHashes = /* @__PURE__ */ new Map();
|
|
2958
|
+
/** 笔记目录缓存 */
|
|
2959
|
+
this.noteDirCache = /* @__PURE__ */ new Set();
|
|
2960
|
+
/** 笔记配置缓存 */
|
|
2961
|
+
this.configCache = /* @__PURE__ */ new Map();
|
|
2965
2962
|
}
|
|
2966
|
-
/** 文件哈希缓存 */
|
|
2967
|
-
fileHashes = /* @__PURE__ */ new Map();
|
|
2968
|
-
/** 笔记目录缓存 */
|
|
2969
|
-
noteDirCache = /* @__PURE__ */ new Set();
|
|
2970
|
-
/** 笔记配置缓存 */
|
|
2971
|
-
configCache = /* @__PURE__ */ new Map();
|
|
2972
2963
|
/**
|
|
2973
2964
|
* 获取指定文件的 MD5 哈希值,若文件不存在或读取失败返回 null
|
|
2974
2965
|
*
|
|
@@ -3124,25 +3115,16 @@ var RENAME_BROADCAST_PATH = "/__tnotes_broadcast_rename";
|
|
|
3124
3115
|
var FileWatcherService = class _FileWatcherService {
|
|
3125
3116
|
constructor(notesDir = NOTES_DIR_PATH) {
|
|
3126
3117
|
this.notesDir = notesDir;
|
|
3118
|
+
this.unlockTimer = null;
|
|
3127
3119
|
if (!this.notesDir) {
|
|
3128
3120
|
throw new Error(NOTES_DIR_NOT_SET_ERROR);
|
|
3129
3121
|
}
|
|
3130
3122
|
this.init();
|
|
3131
3123
|
_FileWatcherService.instance = this;
|
|
3132
3124
|
}
|
|
3133
|
-
static
|
|
3134
|
-
|
|
3135
|
-
|
|
3136
|
-
renameDetector;
|
|
3137
|
-
configHandler;
|
|
3138
|
-
readmeHandler;
|
|
3139
|
-
coordinator;
|
|
3140
|
-
folderHandler;
|
|
3141
|
-
adapter;
|
|
3142
|
-
noteService;
|
|
3143
|
-
readmeService;
|
|
3144
|
-
noteIndexCache;
|
|
3145
|
-
unlockTimer = null;
|
|
3125
|
+
static {
|
|
3126
|
+
this.instance = null;
|
|
3127
|
+
}
|
|
3146
3128
|
static getInstance() {
|
|
3147
3129
|
return _FileWatcherService.instance;
|
|
3148
3130
|
}
|
|
@@ -3367,8 +3349,6 @@ var FileWatcherService = class _FileWatcherService {
|
|
|
3367
3349
|
|
|
3368
3350
|
// core/GitManager.ts
|
|
3369
3351
|
var GitManager = class {
|
|
3370
|
-
logger;
|
|
3371
|
-
dir;
|
|
3372
3352
|
constructor(dir, logger2) {
|
|
3373
3353
|
this.dir = dir;
|
|
3374
3354
|
this.logger = logger2?.child("git") || new Logger({ prefix: "git" });
|
|
@@ -3725,9 +3705,8 @@ var GitManager = class {
|
|
|
3725
3705
|
// core/ProcessManager.ts
|
|
3726
3706
|
import { spawn } from "child_process";
|
|
3727
3707
|
var ProcessManager = class {
|
|
3728
|
-
processes = /* @__PURE__ */ new Map();
|
|
3729
|
-
logger;
|
|
3730
3708
|
constructor() {
|
|
3709
|
+
this.processes = /* @__PURE__ */ new Map();
|
|
3731
3710
|
this.logger = new Logger({ prefix: "process" });
|
|
3732
3711
|
process.on("exit", () => {
|
|
3733
3712
|
this.killAll();
|
|
@@ -3848,7 +3827,6 @@ var ProcessManager = class {
|
|
|
3848
3827
|
|
|
3849
3828
|
// services/git/service.ts
|
|
3850
3829
|
var GitService = class {
|
|
3851
|
-
gitManager;
|
|
3852
3830
|
constructor() {
|
|
3853
3831
|
this.gitManager = new GitManager(ROOT_DIR_PATH);
|
|
3854
3832
|
}
|
|
@@ -3885,19 +3863,12 @@ var GitService = class {
|
|
|
3885
3863
|
await this.gitManager.sync({ commitMessage });
|
|
3886
3864
|
logger.info("Sync completed successfully");
|
|
3887
3865
|
}
|
|
3888
|
-
/**
|
|
3889
|
-
* 获取 Git 状态
|
|
3890
|
-
* @returns Git 状态信息
|
|
3891
|
-
*/
|
|
3892
|
-
async getStatus() {
|
|
3893
|
-
return await this.gitManager.getStatus();
|
|
3894
|
-
}
|
|
3895
3866
|
/**
|
|
3896
3867
|
* 检查是否有未提交的更改
|
|
3897
3868
|
* @returns 是否有未提交的更改
|
|
3898
3869
|
*/
|
|
3899
3870
|
async hasChanges() {
|
|
3900
|
-
const status = await this.getStatus();
|
|
3871
|
+
const status = await this.gitManager.getStatus();
|
|
3901
3872
|
return status.hasChanges;
|
|
3902
3873
|
}
|
|
3903
3874
|
/**
|
|
@@ -3935,7 +3906,6 @@ import {
|
|
|
3935
3906
|
import { join as join8 } from "path";
|
|
3936
3907
|
var BIRTH_DATE = (/* @__PURE__ */ new Date("1999-06-29T00:00:00+08:00")).getTime();
|
|
3937
3908
|
var TimestampService = class {
|
|
3938
|
-
noteManager;
|
|
3939
3909
|
constructor() {
|
|
3940
3910
|
this.noteManager = NoteManager.getInstance();
|
|
3941
3911
|
}
|
|
@@ -4235,26 +4205,42 @@ var TimestampService = class {
|
|
|
4235
4205
|
// services/vitepress/service.ts
|
|
4236
4206
|
import { spawn as spawn2 } from "child_process";
|
|
4237
4207
|
var VitepressService = class _VitepressService {
|
|
4238
|
-
|
|
4239
|
-
|
|
4240
|
-
|
|
4241
|
-
|
|
4242
|
-
|
|
4243
|
-
|
|
4244
|
-
|
|
4245
|
-
|
|
4246
|
-
|
|
4247
|
-
|
|
4248
|
-
|
|
4249
|
-
|
|
4250
|
-
|
|
4251
|
-
|
|
4252
|
-
|
|
4253
|
-
|
|
4254
|
-
|
|
4255
|
-
|
|
4256
|
-
|
|
4257
|
-
|
|
4208
|
+
static {
|
|
4209
|
+
/** VitePress 开发服务器默认端口 */
|
|
4210
|
+
this.DEFAULT_DEV_PORT = 5173;
|
|
4211
|
+
}
|
|
4212
|
+
static {
|
|
4213
|
+
/** VitePress 预览服务器默认端口 */
|
|
4214
|
+
this.DEFAULT_PREVIEW_PORT = 4173;
|
|
4215
|
+
}
|
|
4216
|
+
static {
|
|
4217
|
+
/** 开发服务器进程 ID 后缀 */
|
|
4218
|
+
this.PROCESS_ID_DEV_SUFFIX = "vitepress-dev";
|
|
4219
|
+
}
|
|
4220
|
+
static {
|
|
4221
|
+
/** 预览服务器进程 ID 后缀 */
|
|
4222
|
+
this.PROCESS_ID_PREVIEW_SUFFIX = "vitepress-preview";
|
|
4223
|
+
}
|
|
4224
|
+
static {
|
|
4225
|
+
/** 服务启动超时时间(毫秒) */
|
|
4226
|
+
this.SERVER_STARTUP_TIMEOUT = 6e4;
|
|
4227
|
+
}
|
|
4228
|
+
static {
|
|
4229
|
+
/** 端口释放等待超时时间(毫秒) */
|
|
4230
|
+
this.PORT_RELEASE_TIMEOUT = 3e3;
|
|
4231
|
+
}
|
|
4232
|
+
static {
|
|
4233
|
+
/** 进程清理等待时间(毫秒) */
|
|
4234
|
+
this.PROCESS_CLEANUP_DELAY = 3e3;
|
|
4235
|
+
}
|
|
4236
|
+
static {
|
|
4237
|
+
/** 显示启动服务状态行间隔(毫秒) */
|
|
4238
|
+
this.SERVER_STATUS_LINE_INTERVAL = 1e3;
|
|
4239
|
+
}
|
|
4240
|
+
static {
|
|
4241
|
+
/** 默认包管理器 */
|
|
4242
|
+
this.DEFAULT_PACKAGE_MANAGER = "pnpm";
|
|
4243
|
+
}
|
|
4258
4244
|
constructor() {
|
|
4259
4245
|
this.processManager = new ProcessManager();
|
|
4260
4246
|
this.configManager = ConfigManager.getInstance();
|
|
@@ -4448,10 +4434,9 @@ var VitepressService = class _VitepressService {
|
|
|
4448
4434
|
var BaseCommand = class {
|
|
4449
4435
|
constructor(name) {
|
|
4450
4436
|
this.name = name;
|
|
4437
|
+
this.options = {};
|
|
4451
4438
|
this.logger = logger.child(name);
|
|
4452
4439
|
}
|
|
4453
|
-
logger;
|
|
4454
|
-
options = {};
|
|
4455
4440
|
/** 命令描述(从静态配置读取) */
|
|
4456
4441
|
get description() {
|
|
4457
4442
|
return COMMAND_DESCRIPTIONS[this.name];
|
|
@@ -4481,7 +4466,6 @@ var BaseCommand = class {
|
|
|
4481
4466
|
|
|
4482
4467
|
// commands/note/UpdateNoteConfigCommand.ts
|
|
4483
4468
|
var UpdateNoteConfigCommand = class extends BaseCommand {
|
|
4484
|
-
noteService;
|
|
4485
4469
|
constructor() {
|
|
4486
4470
|
super("update-note-config");
|
|
4487
4471
|
this.noteService = NoteService.getInstance();
|
|
@@ -4533,8 +4517,6 @@ var UpdateNoteConfigCommand = class extends BaseCommand {
|
|
|
4533
4517
|
import { existsSync as existsSync8, renameSync, readFileSync as readFileSync7, writeFileSync as writeFileSync6 } from "fs";
|
|
4534
4518
|
import { join as join9 } from "path";
|
|
4535
4519
|
var RenameNoteCommand = class extends BaseCommand {
|
|
4536
|
-
noteService;
|
|
4537
|
-
readmeService;
|
|
4538
4520
|
constructor() {
|
|
4539
4521
|
super("rename-note");
|
|
4540
4522
|
this.noteService = NoteService.getInstance();
|
|
@@ -4642,6 +4624,7 @@ export {
|
|
|
4642
4624
|
ReadmeService,
|
|
4643
4625
|
NoteService,
|
|
4644
4626
|
FileWatcherService,
|
|
4627
|
+
GitManager,
|
|
4645
4628
|
GitService,
|
|
4646
4629
|
TimestampService,
|
|
4647
4630
|
VitepressService,
|
|
@@ -99,11 +99,8 @@ function validateAndCompleteConfig(config) {
|
|
|
99
99
|
|
|
100
100
|
// config/ConfigManager.ts
|
|
101
101
|
var ConfigManager = class _ConfigManager {
|
|
102
|
-
static instance;
|
|
103
|
-
config = null;
|
|
104
|
-
configPath;
|
|
105
|
-
rootPath;
|
|
106
102
|
constructor(rootPath) {
|
|
103
|
+
this.config = null;
|
|
107
104
|
if (rootPath) {
|
|
108
105
|
this.rootPath = rootPath;
|
|
109
106
|
} else {
|