@tnotesjs/core 0.0.4 → 0.0.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.
@@ -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`);
@@ -927,7 +928,11 @@ function defineNotesConfig(overrides = {}) {
927
928
  if (/^notes\/\d{4}/.test(pageData.relativePath)) {
928
929
  const fullPath = path2.resolve(rootPath, pageData.relativePath);
929
930
  try {
930
- pageData.frontmatter.rawContent = fs2.readFileSync(fullPath, "utf-8");
931
+ const raw = fs2.readFileSync(fullPath, "utf-8");
932
+ pageData.frontmatter.rawContent = raw.replace(
933
+ /<\/(script)/gi,
934
+ "<\\/$1"
935
+ );
931
936
  } catch {
932
937
  pageData.frontmatter.rawContent = null;
933
938
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tnotesjs/core",
3
- "version": "0.0.4",
3
+ "version": "0.0.6",
4
4
  "description": "TNotes 知识库核心框架 —— 基于 VitePress 的笔记管理系统",
5
5
  "type": "module",
6
6
  "bin": {
@@ -123,7 +123,14 @@ export function defineNotesConfig(overrides: UserConfig = {}) {
123
123
  if (/^notes\/\d{4}/.test(pageData.relativePath)) {
124
124
  const fullPath = path.resolve(rootPath, pageData.relativePath)
125
125
  try {
126
- pageData.frontmatter.rawContent = fs.readFileSync(fullPath, 'utf-8')
126
+ const raw = fs.readFileSync(fullPath, 'utf-8')
127
+ // 防止 raw 中的 `</script>` 字面量在被 JSON.stringify 后注入到
128
+ // `<script>…</script>` 块时提前闭合脚本块(导致 Vue SFC 解析报
129
+ // "Invalid end tag")。在源串里把 `</` 拆开即可,复制时仍是原文。
130
+ pageData.frontmatter.rawContent = raw.replace(
131
+ /<\/(script)/gi,
132
+ '<\\/$1',
133
+ )
127
134
  } catch {
128
135
  pageData.frontmatter.rawContent = null
129
136
  }
@@ -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
  }