@tnotesjs/core 0.0.3 → 0.0.5

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.
@@ -4085,13 +4085,9 @@ var VitepressService = class _VitepressService {
4085
4085
  ) ? process.env.NODE_OPTIONS : [process.env.NODE_OPTIONS, "--max-old-space-size=4096"].filter(Boolean).join(" ")
4086
4086
  }
4087
4087
  });
4088
- let buildSucceeded = false;
4089
4088
  const filterOutput = (data) => {
4090
4089
  const str = data.toString();
4091
- if (str.includes("\u{1F528}") || str.includes("\u2705 \u6784\u5EFA\u6210\u529F") || str.includes("\u274C \u6784\u5EFA\u5931\u8D25") || str.includes("\u{1F4C1}") || str.includes("\u{1F4CA}") || str.includes("\u{1F4E6}") || str.includes("\u23F1\uFE0F") || str.includes("Building [") || str.includes("error") || str.includes("Error")) {
4092
- if (str.includes("\u2705 \u6784\u5EFA\u6210\u529F")) {
4093
- buildSucceeded = true;
4094
- }
4090
+ if (str.includes("\u{1F528}") || str.includes("\u2705") || str.includes("\u274C \u6784\u5EFA\u5931\u8D25") || str.includes("\u{1F4C1}") || str.includes("\u{1F4CA}") || str.includes("\u{1F4E6}") || str.includes("\u23F1\uFE0F") || str.includes("\u23F3") || str.includes("Building [") || str.includes("error") || str.includes("Error")) {
4095
4091
  process.stdout.write(data);
4096
4092
  return;
4097
4093
  }
@@ -4105,7 +4101,7 @@ var VitepressService = class _VitepressService {
4105
4101
  reject(err);
4106
4102
  });
4107
4103
  child.on("close", (code) => {
4108
- if (code === 0 || buildSucceeded) {
4104
+ if (code === 0) {
4109
4105
  resolve2();
4110
4106
  } else {
4111
4107
  reject(new Error(`Command failed with code ${code}`));
package/dist/cli/index.js CHANGED
@@ -22,7 +22,7 @@ import {
22
22
  parseArgs,
23
23
  parseReadmeCompletedNotes,
24
24
  runCommand
25
- } from "../chunk-NI5B4S3T.js";
25
+ } from "../chunk-JDVN2QYW.js";
26
26
  import {
27
27
  ConfigManager
28
28
  } from "../chunk-NASIL5FY.js";
@@ -4,7 +4,7 @@ import {
4
4
  UpdateNoteConfigCommand,
5
5
  generateAnchor,
6
6
  logger
7
- } from "../../chunk-NI5B4S3T.js";
7
+ } from "../../chunk-JDVN2QYW.js";
8
8
  import "../../chunk-NASIL5FY.js";
9
9
 
10
10
  // vitepress/config/index.ts
@@ -827,9 +827,10 @@ function buildProgressPlugin(options = {}) {
827
827
  chunkCount: Math.floor(globalChunkCount / 2),
828
828
  transformEndRatio: transformTime / totalTime
829
829
  });
830
- console.log(`\u2705 \u6784\u5EFA\u6210\u529F\uFF01`);
830
+ console.log(`\u{1F528} Rollup \u6253\u5305\u5B8C\u6210`);
831
831
  console.log(` \u{1F4C1} \u8F93\u51FA\u76EE\u5F55: ${globalOutDir}`);
832
832
  console.log(` \u23F1\uFE0F \u8017\u65F6: ${elapsed}s`);
833
+ console.log(` \u23F3 VitePress \u6B63\u5728\u6E32\u67D3\u9875\u9762...`);
833
834
  } else {
834
835
  console.log(`
835
836
  \u274C \u6784\u5EFA\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5\u9519\u8BEF\u4FE1\u606F`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tnotesjs/core",
3
- "version": "0.0.3",
3
+ "version": "0.0.5",
4
4
  "description": "TNotes 知识库核心框架 —— 基于 VitePress 的笔记管理系统",
5
5
  "type": "module",
6
6
  "bin": {
@@ -25,11 +25,21 @@
25
25
  </template>
26
26
 
27
27
  <script setup lang="ts">
28
- import { computed } from 'vue'
28
+ import { computed, ref, onMounted } from 'vue'
29
29
  import { useRoute, useData } from 'vitepress'
30
+ import { SIDEBAR_SHOW_NOTE_ID_KEY } from '../constants'
30
31
  // @ts-expect-error - VitePress Data Loader
31
32
  import { data as sidebarConfig } from '../sidebar.data'
32
33
 
34
+ const showNoteId = ref(false)
35
+
36
+ onMounted(() => {
37
+ const saved = localStorage.getItem(SIDEBAR_SHOW_NOTE_ID_KEY)
38
+ if (saved !== null) {
39
+ showNoteId.value = saved === 'true'
40
+ }
41
+ })
42
+
33
43
  interface NavItem {
34
44
  link: string
35
45
  title: string
@@ -89,13 +99,11 @@ function extractEmojiAndTitle(text: string): { emoji: string; title: string } {
89
99
  if (emojiMatch) {
90
100
  const emoji = emojiMatch[1]
91
101
  const rest = text.slice(emojiMatch[0].length)
92
- // 移除笔记编号(如 "0001. ")
93
- const title = rest.replace(/^\d{4}\.\s*/, '')
102
+ const title = showNoteId.value ? rest : rest.replace(/^\d{4}\.\s*/, '')
94
103
  return { emoji, title }
95
104
  }
96
105
 
97
- // 没有 emoji,只移除编号
98
- const title = text.replace(/^\d{4}\.\s*/, '')
106
+ const title = showNoteId.value ? text : text.replace(/^\d{4}\.\s*/, '')
99
107
  return { emoji: '', title }
100
108
  }
101
109
 
@@ -216,7 +216,10 @@ function renderProgress(
216
216
  const currentPercent = Math.floor(percent * 100)
217
217
  const currentBucket = Math.floor(currentPercent / 10) * 10
218
218
  const now = Date.now()
219
- if (currentBucket <= globalLastLoggedPercent || (now - globalLastOutputTime < 500)) {
219
+ if (
220
+ currentBucket <= globalLastLoggedPercent ||
221
+ now - globalLastOutputTime < 500
222
+ ) {
220
223
  return
221
224
  }
222
225
  globalLastLoggedPercent = currentBucket
@@ -452,9 +455,10 @@ export function buildProgressPlugin(
452
455
  transformEndRatio: transformTime / totalTime,
453
456
  })
454
457
 
455
- console.log(`✅ 构建成功!`)
458
+ console.log(`🔨 Rollup 打包完成`)
456
459
  console.log(` 📁 输出目录: ${globalOutDir}`)
457
460
  console.log(` ⏱️ 耗时: ${elapsed}s`)
461
+ console.log(` ⏳ VitePress 正在渲染页面...`)
458
462
  } else {
459
463
  console.log(`\n❌ 构建失败,请检查错误信息`)
460
464
  }