@tnotesjs/core 0.1.7 → 0.1.10
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.
Potentially problematic release.
This version of @tnotesjs/core might be problematic. Click here for more details.
- package/README.md +3 -3
- package/dist/{chunk-H2NACWVJ.js → chunk-IGIIUJDF.js} +73 -479
- package/dist/{chunk-UIXF3LPU.js → chunk-NASIL5FY.js} +0 -28
- package/dist/cli/index.js +6 -220
- package/dist/index.js +1 -1
- package/dist/vitepress/config/index.js +10 -108
- package/package.json +4 -3
- package/types/shims.d.ts +10 -0
- package/vitepress/config/index.ts +6 -0
|
@@ -1,29 +1,3 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __commonJS = (cb, mod) => function __require() {
|
|
8
|
-
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
19
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
20
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
21
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
22
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
23
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
24
|
-
mod
|
|
25
|
-
));
|
|
26
|
-
|
|
27
1
|
// config/ConfigManager.ts
|
|
28
2
|
import fs from "fs";
|
|
29
3
|
import path from "path";
|
|
@@ -224,8 +198,6 @@ function getConfigManager() {
|
|
|
224
198
|
}
|
|
225
199
|
|
|
226
200
|
export {
|
|
227
|
-
__commonJS,
|
|
228
|
-
__toESM,
|
|
229
201
|
ConfigManager,
|
|
230
202
|
getConfigManager
|
|
231
203
|
};
|
package/dist/cli/index.js
CHANGED
|
@@ -3,7 +3,6 @@ import {
|
|
|
3
3
|
COMMAND_DESCRIPTIONS,
|
|
4
4
|
COMMAND_NAMES,
|
|
5
5
|
COMMAND_OPTIONS,
|
|
6
|
-
EN_WORDS_DIR,
|
|
7
6
|
FileWatcherService,
|
|
8
7
|
GitService,
|
|
9
8
|
NoteIndexCache,
|
|
@@ -13,25 +12,18 @@ import {
|
|
|
13
12
|
ROOT_DIR_PATH,
|
|
14
13
|
ReadmeService,
|
|
15
14
|
RenameNoteCommand,
|
|
16
|
-
SyncCoreService,
|
|
17
|
-
TNOTES_BASE_DIR,
|
|
18
15
|
TimestampService,
|
|
19
16
|
UpdateNoteConfigCommand,
|
|
20
17
|
VitepressService,
|
|
21
18
|
createLogger,
|
|
22
|
-
getTargetDirs,
|
|
23
19
|
handleError,
|
|
24
20
|
logger,
|
|
25
21
|
parseArgs,
|
|
26
|
-
parseReadmeCompletedNotes
|
|
27
|
-
|
|
28
|
-
pushAllRepos,
|
|
29
|
-
runCommand,
|
|
30
|
-
syncAllRepos
|
|
31
|
-
} from "../chunk-H2NACWVJ.js";
|
|
22
|
+
parseReadmeCompletedNotes
|
|
23
|
+
} from "../chunk-IGIIUJDF.js";
|
|
32
24
|
import {
|
|
33
25
|
ConfigManager
|
|
34
|
-
} from "../chunk-
|
|
26
|
+
} from "../chunk-NASIL5FY.js";
|
|
35
27
|
|
|
36
28
|
// commands/update/UpdateCommand.ts
|
|
37
29
|
import { existsSync, readFileSync, writeFileSync } from "fs";
|
|
@@ -40,7 +32,6 @@ var UpdateCommand = class extends BaseCommand {
|
|
|
40
32
|
readmeService;
|
|
41
33
|
noteService;
|
|
42
34
|
quiet = false;
|
|
43
|
-
updateAll = false;
|
|
44
35
|
constructor() {
|
|
45
36
|
super("update");
|
|
46
37
|
this.readmeService = ReadmeService.getInstance();
|
|
@@ -59,18 +50,8 @@ var UpdateCommand = class extends BaseCommand {
|
|
|
59
50
|
logger.setLevel(1 /* INFO */);
|
|
60
51
|
}
|
|
61
52
|
}
|
|
62
|
-
/**
|
|
63
|
-
* 设置是否更新所有知识库
|
|
64
|
-
*/
|
|
65
|
-
setUpdateAll(updateAll) {
|
|
66
|
-
this.updateAll = updateAll;
|
|
67
|
-
}
|
|
68
53
|
async run() {
|
|
69
|
-
|
|
70
|
-
await this.updateAllRepos();
|
|
71
|
-
} else {
|
|
72
|
-
await this.updateCurrentRepo();
|
|
73
|
-
}
|
|
54
|
+
await this.updateCurrentRepo();
|
|
74
55
|
}
|
|
75
56
|
/**
|
|
76
57
|
* 更新当前知识库
|
|
@@ -94,56 +75,6 @@ var UpdateCommand = class extends BaseCommand {
|
|
|
94
75
|
this.logger.success("\u77E5\u8BC6\u5E93\u66F4\u65B0\u5B8C\u6210");
|
|
95
76
|
}
|
|
96
77
|
}
|
|
97
|
-
/**
|
|
98
|
-
* 更新所有知识库
|
|
99
|
-
*/
|
|
100
|
-
async updateAllRepos() {
|
|
101
|
-
try {
|
|
102
|
-
const targetDirs = getTargetDirs(TNOTES_BASE_DIR, "TNotes.", [
|
|
103
|
-
ROOT_DIR_PATH,
|
|
104
|
-
EN_WORDS_DIR
|
|
105
|
-
]);
|
|
106
|
-
if (targetDirs.length === 0) {
|
|
107
|
-
this.logger.warn("\u672A\u627E\u5230\u7B26\u5408\u6761\u4EF6\u7684\u77E5\u8BC6\u5E93");
|
|
108
|
-
return;
|
|
109
|
-
}
|
|
110
|
-
this.logger.info(`\u6B63\u5728\u66F4\u65B0 ${targetDirs.length} \u4E2A\u77E5\u8BC6\u5E93...`);
|
|
111
|
-
let successCount = 0;
|
|
112
|
-
let failCount = 0;
|
|
113
|
-
for (let i = 0; i < targetDirs.length; i++) {
|
|
114
|
-
const dir = targetDirs[i];
|
|
115
|
-
const repoName = dir.split("/").pop() || dir;
|
|
116
|
-
try {
|
|
117
|
-
process.stdout.write(
|
|
118
|
-
`\r [${i + 1}/${targetDirs.length}] \u6B63\u5728\u66F4\u65B0: ${repoName}...`
|
|
119
|
-
);
|
|
120
|
-
await runCommand("pnpm tn:update --quiet", dir);
|
|
121
|
-
successCount++;
|
|
122
|
-
} catch (error) {
|
|
123
|
-
failCount++;
|
|
124
|
-
console.log();
|
|
125
|
-
this.logger.error(
|
|
126
|
-
`\u66F4\u65B0\u5931\u8D25: ${repoName} - ${error instanceof Error ? error.message : String(error)}`
|
|
127
|
-
);
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
console.log();
|
|
131
|
-
if (failCount === 0) {
|
|
132
|
-
this.logger.success(
|
|
133
|
-
`\u2705 \u6240\u6709\u77E5\u8BC6\u5E93\u66F4\u65B0\u5B8C\u6210: ${successCount}/${targetDirs.length}`
|
|
134
|
-
);
|
|
135
|
-
} else {
|
|
136
|
-
this.logger.warn(
|
|
137
|
-
`\u26A0\uFE0F \u66F4\u65B0\u5B8C\u6210: ${successCount} \u6210\u529F, ${failCount} \u5931\u8D25 (\u5171 ${targetDirs.length} \u4E2A)`
|
|
138
|
-
);
|
|
139
|
-
}
|
|
140
|
-
} catch (error) {
|
|
141
|
-
this.logger.error(
|
|
142
|
-
`\u6279\u91CF\u66F4\u65B0\u5931\u8D25: ${error instanceof Error ? error.message : String(error)}`
|
|
143
|
-
);
|
|
144
|
-
throw error;
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
78
|
/**
|
|
148
79
|
* 更新 root_item 配置
|
|
149
80
|
* 只更新当前月份的完成笔记数量
|
|
@@ -194,22 +125,11 @@ var UpdateCommand = class extends BaseCommand {
|
|
|
194
125
|
import { readFileSync as readFileSync2, writeFileSync as writeFileSync2 } from "fs";
|
|
195
126
|
import { execSync } from "child_process";
|
|
196
127
|
var UpdateCompletedCountCommand = class extends BaseCommand {
|
|
197
|
-
updateAll = false;
|
|
198
128
|
constructor() {
|
|
199
129
|
super("update-completed-count");
|
|
200
130
|
}
|
|
201
|
-
/**
|
|
202
|
-
* 设置是否更新所有知识库
|
|
203
|
-
*/
|
|
204
|
-
setUpdateAll(updateAll) {
|
|
205
|
-
this.updateAll = updateAll;
|
|
206
|
-
}
|
|
207
131
|
async run() {
|
|
208
|
-
|
|
209
|
-
await this.updateAllRepos();
|
|
210
|
-
} else {
|
|
211
|
-
await this.updateCurrentRepo();
|
|
212
|
-
}
|
|
132
|
+
await this.updateCurrentRepo();
|
|
213
133
|
}
|
|
214
134
|
/**
|
|
215
135
|
* 更新当前知识库
|
|
@@ -241,58 +161,6 @@ var UpdateCompletedCountCommand = class extends BaseCommand {
|
|
|
241
161
|
throw error;
|
|
242
162
|
}
|
|
243
163
|
}
|
|
244
|
-
/**
|
|
245
|
-
* 更新所有知识库
|
|
246
|
-
*/
|
|
247
|
-
async updateAllRepos() {
|
|
248
|
-
try {
|
|
249
|
-
const targetDirs = getTargetDirs(TNOTES_BASE_DIR, "TNotes.", [
|
|
250
|
-
ROOT_DIR_PATH,
|
|
251
|
-
EN_WORDS_DIR
|
|
252
|
-
]);
|
|
253
|
-
if (targetDirs.length === 0) {
|
|
254
|
-
this.logger.warn("\u672A\u627E\u5230\u7B26\u5408\u6761\u4EF6\u7684\u77E5\u8BC6\u5E93");
|
|
255
|
-
return;
|
|
256
|
-
}
|
|
257
|
-
this.logger.info(
|
|
258
|
-
`\u6B63\u5728\u66F4\u65B0 ${targetDirs.length} \u4E2A\u77E5\u8BC6\u5E93\u7684\u5B8C\u6210\u6570\u91CF\u5386\u53F2\u8BB0\u5F55...`
|
|
259
|
-
);
|
|
260
|
-
let successCount = 0;
|
|
261
|
-
let failCount = 0;
|
|
262
|
-
for (let i = 0; i < targetDirs.length; i++) {
|
|
263
|
-
const dir = targetDirs[i];
|
|
264
|
-
const repoName = dir.split("/").pop() || dir;
|
|
265
|
-
try {
|
|
266
|
-
process.stdout.write(
|
|
267
|
-
`\r [${i + 1}/${targetDirs.length}] \u6B63\u5728\u66F4\u65B0: ${repoName}...`
|
|
268
|
-
);
|
|
269
|
-
await runCommand("pnpm tn:update-completed-count", dir);
|
|
270
|
-
successCount++;
|
|
271
|
-
} catch (error) {
|
|
272
|
-
failCount++;
|
|
273
|
-
console.log();
|
|
274
|
-
this.logger.error(
|
|
275
|
-
`\u66F4\u65B0\u5931\u8D25: ${repoName} - ${error instanceof Error ? error.message : String(error)}`
|
|
276
|
-
);
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
console.log();
|
|
280
|
-
if (failCount === 0) {
|
|
281
|
-
this.logger.success(
|
|
282
|
-
`\u2705 \u6240\u6709\u77E5\u8BC6\u5E93\u5386\u53F2\u6570\u636E\u66F4\u65B0\u5B8C\u6210: ${successCount}/${targetDirs.length}`
|
|
283
|
-
);
|
|
284
|
-
} else {
|
|
285
|
-
this.logger.warn(
|
|
286
|
-
`\u26A0\uFE0F \u66F4\u65B0\u5B8C\u6210: ${successCount} \u6210\u529F, ${failCount} \u5931\u8D25 (\u5171 ${targetDirs.length} \u4E2A)`
|
|
287
|
-
);
|
|
288
|
-
}
|
|
289
|
-
} catch (error) {
|
|
290
|
-
this.logger.error(
|
|
291
|
-
`\u6279\u91CF\u66F4\u65B0\u5931\u8D25: ${error instanceof Error ? error.message : String(error)}`
|
|
292
|
-
);
|
|
293
|
-
throw error;
|
|
294
|
-
}
|
|
295
|
-
}
|
|
296
164
|
/**
|
|
297
165
|
* 获取历史每个月的 completed_notes_count(最近12个月)
|
|
298
166
|
*
|
|
@@ -395,31 +263,12 @@ var UpdateCompletedCountCommand = class extends BaseCommand {
|
|
|
395
263
|
var PushCommand = class extends BaseCommand {
|
|
396
264
|
gitService;
|
|
397
265
|
timestampService;
|
|
398
|
-
pushAll = false;
|
|
399
266
|
constructor() {
|
|
400
267
|
super("push");
|
|
401
268
|
this.gitService = new GitService();
|
|
402
269
|
this.timestampService = new TimestampService();
|
|
403
270
|
}
|
|
404
|
-
/**
|
|
405
|
-
* 设置是否推送所有仓库
|
|
406
|
-
*/
|
|
407
|
-
setPushAll(value) {
|
|
408
|
-
this.pushAll = value;
|
|
409
|
-
}
|
|
410
271
|
async run() {
|
|
411
|
-
if (this.pushAll) {
|
|
412
|
-
const parallel = process.env.PARALLEL_PUSH === "true";
|
|
413
|
-
const force = this.options.force === true;
|
|
414
|
-
if (parallel) {
|
|
415
|
-
this.logger.info("Parallel push mode enabled");
|
|
416
|
-
}
|
|
417
|
-
if (force) {
|
|
418
|
-
this.logger.warn("\u4F7F\u7528\u5F3A\u5236\u63A8\u9001\u6A21\u5F0F (--force)");
|
|
419
|
-
}
|
|
420
|
-
await pushAllRepos({ parallel, force });
|
|
421
|
-
return;
|
|
422
|
-
}
|
|
423
272
|
try {
|
|
424
273
|
this.logger.info("\u68C0\u67E5\u662F\u5426\u6709\u66F4\u6539...");
|
|
425
274
|
const status = await this.gitService.getStatus();
|
|
@@ -462,26 +311,11 @@ var PushCommand = class extends BaseCommand {
|
|
|
462
311
|
// commands/git/PullCommand.ts
|
|
463
312
|
var PullCommand = class extends BaseCommand {
|
|
464
313
|
gitService;
|
|
465
|
-
pullAll = false;
|
|
466
314
|
constructor() {
|
|
467
315
|
super("pull");
|
|
468
316
|
this.gitService = new GitService();
|
|
469
317
|
}
|
|
470
|
-
/**
|
|
471
|
-
* 设置是否拉取所有仓库
|
|
472
|
-
*/
|
|
473
|
-
setPullAll(value) {
|
|
474
|
-
this.pullAll = value;
|
|
475
|
-
}
|
|
476
318
|
async run() {
|
|
477
|
-
if (this.pullAll) {
|
|
478
|
-
const parallel = process.env.PARALLEL_PULL === "true";
|
|
479
|
-
if (parallel) {
|
|
480
|
-
this.logger.info("Parallel pull mode enabled");
|
|
481
|
-
}
|
|
482
|
-
await pullAllRepos({ parallel });
|
|
483
|
-
return;
|
|
484
|
-
}
|
|
485
319
|
this.logger.info("\u6B63\u5728\u4ECE\u8FDC\u7A0B\u4ED3\u5E93\u62C9\u53D6...");
|
|
486
320
|
await this.gitService.pull();
|
|
487
321
|
this.logger.success("\u62C9\u53D6\u5B8C\u6210");
|
|
@@ -491,22 +325,11 @@ var PullCommand = class extends BaseCommand {
|
|
|
491
325
|
// commands/git/SyncCommand.ts
|
|
492
326
|
var SyncCommand = class extends BaseCommand {
|
|
493
327
|
gitService;
|
|
494
|
-
syncAll = false;
|
|
495
328
|
constructor() {
|
|
496
329
|
super("sync");
|
|
497
330
|
this.gitService = new GitService();
|
|
498
331
|
}
|
|
499
|
-
/**
|
|
500
|
-
* 设置是否同步所有仓库
|
|
501
|
-
*/
|
|
502
|
-
setSyncAll(value) {
|
|
503
|
-
this.syncAll = value;
|
|
504
|
-
}
|
|
505
332
|
async run() {
|
|
506
|
-
if (this.syncAll) {
|
|
507
|
-
await syncAllRepos({ parallel: false });
|
|
508
|
-
return;
|
|
509
|
-
}
|
|
510
333
|
this.logger.info("\u6B63\u5728\u540C\u6B65\u4ED3\u5E93...");
|
|
511
334
|
const hasChanges = await this.gitService.hasChanges();
|
|
512
335
|
if (hasChanges) {
|
|
@@ -710,18 +533,6 @@ var CreateNoteCommand = class extends BaseCommand {
|
|
|
710
533
|
}
|
|
711
534
|
};
|
|
712
535
|
|
|
713
|
-
// commands/maintenance/SyncCoreCommand.ts
|
|
714
|
-
var SyncCoreCommand = class extends BaseCommand {
|
|
715
|
-
syncCoreService;
|
|
716
|
-
constructor() {
|
|
717
|
-
super("sync-core");
|
|
718
|
-
this.syncCoreService = new SyncCoreService();
|
|
719
|
-
}
|
|
720
|
-
async run() {
|
|
721
|
-
await this.syncCoreService.syncToAllRepos();
|
|
722
|
-
}
|
|
723
|
-
};
|
|
724
|
-
|
|
725
536
|
// commands/maintenance/FixTimestampsCommand.ts
|
|
726
537
|
var FixTimestampsCommand = class extends BaseCommand {
|
|
727
538
|
timestampService;
|
|
@@ -763,17 +574,9 @@ var COMMAND_CATEGORIES = {
|
|
|
763
574
|
COMMAND_NAMES.CREATE_NOTES
|
|
764
575
|
],
|
|
765
576
|
"Git \u64CD\u4F5C": [COMMAND_NAMES.PUSH, COMMAND_NAMES.PULL, COMMAND_NAMES.SYNC],
|
|
766
|
-
\u5176\u4ED6: [
|
|
767
|
-
COMMAND_NAMES.SYNC_SCRIPTS,
|
|
768
|
-
COMMAND_NAMES.FIX_TIMESTAMPS,
|
|
769
|
-
COMMAND_NAMES.HELP
|
|
770
|
-
]
|
|
577
|
+
\u5176\u4ED6: [COMMAND_NAMES.FIX_TIMESTAMPS, COMMAND_NAMES.HELP]
|
|
771
578
|
};
|
|
772
579
|
var COMMAND_OPTIONS_INFO = {
|
|
773
|
-
[COMMAND_OPTIONS.ALL]: {
|
|
774
|
-
description: "\u6279\u91CF\u64CD\u4F5C\u6240\u6709\u77E5\u8BC6\u5E93",
|
|
775
|
-
applicableTo: "update/update-completed-count/push/pull/sync"
|
|
776
|
-
},
|
|
777
580
|
[COMMAND_OPTIONS.QUIET]: {
|
|
778
581
|
description: "\u9759\u9ED8\u6A21\u5F0F",
|
|
779
582
|
applicableTo: "update"
|
|
@@ -814,14 +617,9 @@ var HelpCommand = class extends BaseCommand {
|
|
|
814
617
|
this.logger.info(" pnpm tn:build");
|
|
815
618
|
this.logger.info(" pnpm tn:create-notes # \u6279\u91CF\u521B\u5EFA\u7B14\u8BB0");
|
|
816
619
|
this.logger.info(" pnpm tn:update");
|
|
817
|
-
this.logger.info(" pnpm tn:update --all # \u66F4\u65B0\u6240\u6709\u77E5\u8BC6\u5E93");
|
|
818
620
|
this.logger.info(
|
|
819
621
|
" pnpm tn:update-completed-count # \u751F\u6210\u5F53\u524D\u77E5\u8BC6\u5E93\u6700\u8FD1 12 \u4E2A\u6708\u7684\u5B8C\u6210\u7B14\u8BB0\u6570\u91CF\u7EDF\u8BA1"
|
|
820
622
|
);
|
|
821
|
-
this.logger.info(
|
|
822
|
-
" pnpm tn:update-completed-count --all # \u751F\u6210\u6240\u6709\u77E5\u8BC6\u5E93\u6700\u8FD1 12 \u4E2A\u6708\u7684\u5B8C\u6210\u7B14\u8BB0\u6570\u91CF\u7EDF\u8BA1"
|
|
823
|
-
);
|
|
824
|
-
this.logger.info(" pnpm tn:push --all # \u63A8\u9001\u6240\u6709\u77E5\u8BC6\u5E93");
|
|
825
623
|
this.logger.info("");
|
|
826
624
|
this.logger.info("\u53C2\u6570\uFF1A");
|
|
827
625
|
for (const [option, info] of Object.entries(COMMAND_OPTIONS_INFO)) {
|
|
@@ -850,7 +648,6 @@ var commandFactories = {
|
|
|
850
648
|
pull: () => new PullCommand(),
|
|
851
649
|
sync: () => new SyncCommand(),
|
|
852
650
|
"create-notes": () => new CreateNoteCommand(),
|
|
853
|
-
"sync-core": () => new SyncCoreCommand(),
|
|
854
651
|
"fix-timestamps": () => new FixTimestampsCommand(),
|
|
855
652
|
"update-note-config": () => new UpdateNoteConfigCommand(),
|
|
856
653
|
"rename-note": () => new RenameNoteCommand(),
|
|
@@ -900,20 +697,9 @@ ${"-".repeat(66)}
|
|
|
900
697
|
if (commandName === COMMAND_NAMES.UPDATE) {
|
|
901
698
|
const cmd = command;
|
|
902
699
|
if (args.quiet) cmd.setQuiet(true);
|
|
903
|
-
if (args.all) cmd.setUpdateAll(true);
|
|
904
|
-
} else if (commandName === COMMAND_NAMES.UPDATE_COMPLETED_COUNT) {
|
|
905
|
-
const cmd = command;
|
|
906
|
-
if (args.all) cmd.setUpdateAll(true);
|
|
907
700
|
} else if (commandName === COMMAND_NAMES.PUSH) {
|
|
908
701
|
const cmd = command;
|
|
909
702
|
if (args.force) cmd.setOptions({ force: true });
|
|
910
|
-
if (args.all) cmd.setPushAll(true);
|
|
911
|
-
} else if (commandName === COMMAND_NAMES.PULL) {
|
|
912
|
-
const cmd = command;
|
|
913
|
-
if (args.all) cmd.setPullAll(true);
|
|
914
|
-
} else if (commandName === COMMAND_NAMES.SYNC) {
|
|
915
|
-
const cmd = command;
|
|
916
|
-
if (args.all) cmd.setSyncAll(true);
|
|
917
703
|
}
|
|
918
704
|
await command.execute();
|
|
919
705
|
} catch (error) {
|
package/dist/index.js
CHANGED
|
@@ -4,112 +4,8 @@ import {
|
|
|
4
4
|
UpdateNoteConfigCommand,
|
|
5
5
|
generateAnchor,
|
|
6
6
|
logger
|
|
7
|
-
} from "../../chunk-
|
|
8
|
-
import
|
|
9
|
-
__commonJS,
|
|
10
|
-
__toESM
|
|
11
|
-
} from "../../chunk-UIXF3LPU.js";
|
|
12
|
-
|
|
13
|
-
// node_modules/.pnpm/markdown-it-task-lists@2.1.1/node_modules/markdown-it-task-lists/index.js
|
|
14
|
-
var require_markdown_it_task_lists = __commonJS({
|
|
15
|
-
"node_modules/.pnpm/markdown-it-task-lists@2.1.1/node_modules/markdown-it-task-lists/index.js"(exports, module) {
|
|
16
|
-
var disableCheckboxes = true;
|
|
17
|
-
var useLabelWrapper = false;
|
|
18
|
-
var useLabelAfter = false;
|
|
19
|
-
module.exports = function(md, options) {
|
|
20
|
-
if (options) {
|
|
21
|
-
disableCheckboxes = !options.enabled;
|
|
22
|
-
useLabelWrapper = !!options.label;
|
|
23
|
-
useLabelAfter = !!options.labelAfter;
|
|
24
|
-
}
|
|
25
|
-
md.core.ruler.after("inline", "github-task-lists", function(state) {
|
|
26
|
-
var tokens = state.tokens;
|
|
27
|
-
for (var i = 2; i < tokens.length; i++) {
|
|
28
|
-
if (isTodoItem(tokens, i)) {
|
|
29
|
-
todoify(tokens[i], state.Token);
|
|
30
|
-
attrSet(tokens[i - 2], "class", "task-list-item" + (!disableCheckboxes ? " enabled" : ""));
|
|
31
|
-
attrSet(tokens[parentToken(tokens, i - 2)], "class", "contains-task-list");
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
|
-
};
|
|
36
|
-
function attrSet(token, name, value) {
|
|
37
|
-
var index = token.attrIndex(name);
|
|
38
|
-
var attr = [name, value];
|
|
39
|
-
if (index < 0) {
|
|
40
|
-
token.attrPush(attr);
|
|
41
|
-
} else {
|
|
42
|
-
token.attrs[index] = attr;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
function parentToken(tokens, index) {
|
|
46
|
-
var targetLevel = tokens[index].level - 1;
|
|
47
|
-
for (var i = index - 1; i >= 0; i--) {
|
|
48
|
-
if (tokens[i].level === targetLevel) {
|
|
49
|
-
return i;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
return -1;
|
|
53
|
-
}
|
|
54
|
-
function isTodoItem(tokens, index) {
|
|
55
|
-
return isInline(tokens[index]) && isParagraph(tokens[index - 1]) && isListItem(tokens[index - 2]) && startsWithTodoMarkdown(tokens[index]);
|
|
56
|
-
}
|
|
57
|
-
function todoify(token, TokenConstructor) {
|
|
58
|
-
token.children.unshift(makeCheckbox(token, TokenConstructor));
|
|
59
|
-
token.children[1].content = token.children[1].content.slice(3);
|
|
60
|
-
token.content = token.content.slice(3);
|
|
61
|
-
if (useLabelWrapper) {
|
|
62
|
-
if (useLabelAfter) {
|
|
63
|
-
token.children.pop();
|
|
64
|
-
var id = "task-item-" + Math.ceil(Math.random() * (1e4 * 1e3) - 1e3);
|
|
65
|
-
token.children[0].content = token.children[0].content.slice(0, -1) + ' id="' + id + '">';
|
|
66
|
-
token.children.push(afterLabel(token.content, id, TokenConstructor));
|
|
67
|
-
} else {
|
|
68
|
-
token.children.unshift(beginLabel(TokenConstructor));
|
|
69
|
-
token.children.push(endLabel(TokenConstructor));
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
function makeCheckbox(token, TokenConstructor) {
|
|
74
|
-
var checkbox = new TokenConstructor("html_inline", "", 0);
|
|
75
|
-
var disabledAttr = disableCheckboxes ? ' disabled="" ' : "";
|
|
76
|
-
if (token.content.indexOf("[ ] ") === 0) {
|
|
77
|
-
checkbox.content = '<input class="task-list-item-checkbox"' + disabledAttr + 'type="checkbox">';
|
|
78
|
-
} else if (token.content.indexOf("[x] ") === 0 || token.content.indexOf("[X] ") === 0) {
|
|
79
|
-
checkbox.content = '<input class="task-list-item-checkbox" checked=""' + disabledAttr + 'type="checkbox">';
|
|
80
|
-
}
|
|
81
|
-
return checkbox;
|
|
82
|
-
}
|
|
83
|
-
function beginLabel(TokenConstructor) {
|
|
84
|
-
var token = new TokenConstructor("html_inline", "", 0);
|
|
85
|
-
token.content = "<label>";
|
|
86
|
-
return token;
|
|
87
|
-
}
|
|
88
|
-
function endLabel(TokenConstructor) {
|
|
89
|
-
var token = new TokenConstructor("html_inline", "", 0);
|
|
90
|
-
token.content = "</label>";
|
|
91
|
-
return token;
|
|
92
|
-
}
|
|
93
|
-
function afterLabel(content, id, TokenConstructor) {
|
|
94
|
-
var token = new TokenConstructor("html_inline", "", 0);
|
|
95
|
-
token.content = '<label class="task-list-item-label" for="' + id + '">' + content + "</label>";
|
|
96
|
-
token.attrs = [{ for: id }];
|
|
97
|
-
return token;
|
|
98
|
-
}
|
|
99
|
-
function isInline(token) {
|
|
100
|
-
return token.type === "inline";
|
|
101
|
-
}
|
|
102
|
-
function isParagraph(token) {
|
|
103
|
-
return token.type === "paragraph_open";
|
|
104
|
-
}
|
|
105
|
-
function isListItem(token) {
|
|
106
|
-
return token.type === "list_item_open";
|
|
107
|
-
}
|
|
108
|
-
function startsWithTodoMarkdown(token) {
|
|
109
|
-
return token.content.indexOf("[ ] ") === 0 || token.content.indexOf("[x] ") === 0 || token.content.indexOf("[X] ") === 0;
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
});
|
|
7
|
+
} from "../../chunk-IGIIUJDF.js";
|
|
8
|
+
import "../../chunk-NASIL5FY.js";
|
|
113
9
|
|
|
114
10
|
// vitepress/config/index.ts
|
|
115
11
|
import fs2 from "fs";
|
|
@@ -143,9 +39,9 @@ function getHeadConfig(config, githubPageUrl) {
|
|
|
143
39
|
}
|
|
144
40
|
|
|
145
41
|
// vitepress/configs/markdown.config.ts
|
|
146
|
-
var import_markdown_it_task_lists = __toESM(require_markdown_it_task_lists(), 1);
|
|
147
42
|
import markdownItContainer from "markdown-it-container";
|
|
148
43
|
import mila from "markdown-it-link-attributes";
|
|
44
|
+
import markdownItTaskLists from "markdown-it-task-lists";
|
|
149
45
|
import fs from "fs";
|
|
150
46
|
import path from "path";
|
|
151
47
|
function esc(s = "") {
|
|
@@ -369,7 +265,7 @@ function getMarkdownConfig() {
|
|
|
369
265
|
});
|
|
370
266
|
simpleMermaidMarkdown(md);
|
|
371
267
|
configureMarkMapContainer(md);
|
|
372
|
-
md.use(
|
|
268
|
+
md.use(markdownItTaskLists);
|
|
373
269
|
md.use(mila, {
|
|
374
270
|
attrs: {
|
|
375
271
|
target: "_self",
|
|
@@ -968,9 +864,15 @@ function defineNotesConfig(overrides = {}) {
|
|
|
968
864
|
__TNOTES_ROOT_ITEM__: JSON.stringify(config.root_item),
|
|
969
865
|
...overrideVite?.define
|
|
970
866
|
},
|
|
867
|
+
resolve: {
|
|
868
|
+
dedupe: ["vue", "vitepress"],
|
|
869
|
+
...overrideVite?.resolve
|
|
870
|
+
},
|
|
971
871
|
optimizeDeps: {
|
|
972
872
|
include: [
|
|
873
|
+
// VitePress 内部 CJS 依赖 —— 需要 Vite 预构建为 ESM
|
|
973
874
|
"vitepress > @vscode/markdown-it-katex",
|
|
875
|
+
"vitepress > @braintree/sanitize-url",
|
|
974
876
|
"vitepress > dayjs",
|
|
975
877
|
"vitepress > dayjs/plugin/utc",
|
|
976
878
|
"vitepress > dayjs/plugin/localizedFormat"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tnotesjs/core",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.10",
|
|
4
4
|
"description": "TNotes 知识库核心框架 —— 基于 VitePress 的笔记管理系统",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -41,10 +41,13 @@
|
|
|
41
41
|
"markdown-it-container": "^4.0.0",
|
|
42
42
|
"markdown-it-link-attributes": "^4.0.1",
|
|
43
43
|
"markdown-it-mathjax3": "^4.3.2",
|
|
44
|
+
"markdown-it-task-lists": "^2.1.1",
|
|
44
45
|
"marked": "^15.0.11",
|
|
45
46
|
"markmap-lib": "^0.18.12",
|
|
46
47
|
"markmap-toolbar": "^0.18.12",
|
|
47
48
|
"markmap-view": "^0.18.12",
|
|
49
|
+
"mermaid": "^11.5.0",
|
|
50
|
+
"sass-embedded": "^1.90.0",
|
|
48
51
|
"swiper": "^11.2.1",
|
|
49
52
|
"uuid": "^11.1.0",
|
|
50
53
|
"vue-echarts": "^8.0.1"
|
|
@@ -52,8 +55,6 @@
|
|
|
52
55
|
"devDependencies": {
|
|
53
56
|
"@types/markdown-it": "^14.1.2",
|
|
54
57
|
"@types/node": "^24.6.2",
|
|
55
|
-
"markdown-it-task-lists": "^2.1.1",
|
|
56
|
-
"sass-embedded": "^1.90.0",
|
|
57
58
|
"tsup": "^8.5.1",
|
|
58
59
|
"typescript": "^5.9.3"
|
|
59
60
|
},
|
package/types/shims.d.ts
ADDED
|
@@ -102,9 +102,15 @@ export function defineNotesConfig(overrides: UserConfig = {}) {
|
|
|
102
102
|
__TNOTES_ROOT_ITEM__: JSON.stringify(config.root_item),
|
|
103
103
|
...overrideVite?.define,
|
|
104
104
|
},
|
|
105
|
+
resolve: {
|
|
106
|
+
dedupe: ['vue', 'vitepress'],
|
|
107
|
+
...overrideVite?.resolve,
|
|
108
|
+
},
|
|
105
109
|
optimizeDeps: {
|
|
106
110
|
include: [
|
|
111
|
+
// VitePress 内部 CJS 依赖 —— 需要 Vite 预构建为 ESM
|
|
107
112
|
'vitepress > @vscode/markdown-it-katex',
|
|
113
|
+
'vitepress > @braintree/sanitize-url',
|
|
108
114
|
'vitepress > dayjs',
|
|
109
115
|
'vitepress > dayjs/plugin/utc',
|
|
110
116
|
'vitepress > dayjs/plugin/localizedFormat',
|