@tnotesjs/core 0.7.0 → 0.8.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/commands/BaseCommand.ts +58 -0
- package/commands/build/BuildCommand.ts +25 -0
- package/commands/build/PreviewCommand.ts +29 -0
- package/commands/build/index.ts +8 -0
- package/commands/dev/DevCommand.ts +75 -0
- package/commands/dev/index.ts +7 -0
- package/commands/git/PullCommand.ts +25 -0
- package/commands/git/PushCommand.ts +64 -0
- package/commands/git/index.ts +8 -0
- package/commands/index.ts +11 -0
- package/commands/init-sub-repo/InitSubRepoCommand.ts +206 -0
- package/commands/init-sub-repo/index.ts +1 -0
- package/commands/misc/HelpCommand.ts +104 -0
- package/commands/misc/index.ts +7 -0
- package/commands/models.ts +87 -0
- package/commands/note/CreateNoteCommand.ts +160 -0
- package/commands/note/RenameNoteCommand.ts +147 -0
- package/commands/note/UpdateNoteConfigCommand.ts +78 -0
- package/commands/note/index.ts +9 -0
- package/commands/registry.ts +47 -0
- package/commands/update/UpdateCommand.ts +219 -0
- package/commands/update/index.ts +7 -0
- package/commands/update-completed-count/UpdateCompletedCountCommand.ts +208 -0
- package/commands/update-completed-count/index.ts +5 -0
- package/dist/markdown/index.cjs +6 -9
- package/dist/markdown/index.js +6 -9
- package/dist/vitepress/config/index.cjs +214 -58
- package/dist/vitepress/config/index.js +208 -52
- package/markdown/components.ts +86 -0
- package/markdown/index.ts +17 -0
- package/markdown/noteFormatter.test.ts +44 -0
- package/markdown/noteFormatter.ts +237 -0
- package/package.json +7 -3
- package/vitepress/components/BilibiliOutsidePlayer/BilibiliOutsidePlayer.vue +9 -18
- package/vitepress/components/EnWordList/EnWordList.vue +16 -662
- package/vitepress/components/Footprints/Footprints.vue +15 -537
- package/vitepress/components/Mermaid/Mermaid.vue +13 -588
- package/vitepress/components/MindmapPreview/MindmapPreview.vue +12 -434
- package/vitepress/components/MindmapPreview/markdown.ts +1 -1
- package/vitepress/components/NotesTable/NotesTable.vue +11 -130
- package/vitepress/configs/markdown.config.ts +170 -26
- package/vitepress/theme/index.ts +9 -13
- package/vitepress/theme/styles/base.scss +15 -0
- package/workspace/atomic.ts +113 -0
- package/workspace/errors.ts +27 -0
- package/workspace/index.ts +40 -0
- package/workspace/mutationQueue.ts +28 -0
- package/workspace/paths.ts +64 -0
- package/workspace/reconcile.test.ts +300 -0
- package/workspace/reconcile.ts +95 -0
- package/workspace/scanner.ts +292 -0
- package/workspace/types.ts +224 -0
- package/workspace/workspace.test.ts +333 -0
- package/workspace/workspace.ts +1020 -0
- package/vitepress/components/EnWordList/RightClickMenu.vue +0 -93
|
@@ -63,12 +63,10 @@ function getHeadConfig(config, githubPageUrl) {
|
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
// vitepress/configs/markdown.config.ts
|
|
66
|
-
|
|
67
66
|
var _markdownitcontainer = require('markdown-it-container'); var _markdownitcontainer2 = _interopRequireDefault(_markdownitcontainer);
|
|
68
67
|
var _markdownitlinkattributes = require('markdown-it-link-attributes'); var _markdownitlinkattributes2 = _interopRequireDefault(_markdownitlinkattributes);
|
|
69
68
|
var _markdownittasklists = require('markdown-it-task-lists'); var _markdownittasklists2 = _interopRequireDefault(_markdownittasklists);
|
|
70
69
|
|
|
71
|
-
|
|
72
70
|
// vitepress/components/MindmapPreview/markdown.ts
|
|
73
71
|
function cleanHeadingText(value) {
|
|
74
72
|
return value.trim().replace(/\s+#+\s*$/, "").trim();
|
|
@@ -90,19 +88,6 @@ function parseMindmapFence(openLine) {
|
|
|
90
88
|
}
|
|
91
89
|
return options;
|
|
92
90
|
}
|
|
93
|
-
function parseMindmapReference(line) {
|
|
94
|
-
const match = line.trim().match(/^<<<\s+(.+?)\s*$/);
|
|
95
|
-
if (!match) return null;
|
|
96
|
-
let rest = match[1].trim();
|
|
97
|
-
let title;
|
|
98
|
-
const titleMatch = rest.match(/\s+\[([^\]]+)\]\s*$/);
|
|
99
|
-
if (titleMatch) {
|
|
100
|
-
title = cleanHeadingText(titleMatch[1]) || void 0;
|
|
101
|
-
rest = rest.slice(0, titleMatch.index).trim();
|
|
102
|
-
}
|
|
103
|
-
const path6 = rest.replace(/^(?:"([\s\S]*)"|'([\s\S]*)')$/, "$1$2").trim();
|
|
104
|
-
return path6 ? { path: path6, title } : null;
|
|
105
|
-
}
|
|
106
91
|
function normalizeMindmapMarkdown(source, options = {}) {
|
|
107
92
|
const lines = source.replace(/\r\n?/g, "\n").split("\n");
|
|
108
93
|
let existingTitle = "";
|
|
@@ -125,6 +110,79 @@ ${body.join("\n")}
|
|
|
125
110
|
`;
|
|
126
111
|
}
|
|
127
112
|
|
|
113
|
+
// node_modules/.pnpm/@tnotesjs+ui@0.1.1_vue@3.5.31_typescript@5.9.3_/node_modules/@tnotesjs/ui/src/components/Footprints/parse.ts
|
|
114
|
+
function parseFootprintsDatetime(meta) {
|
|
115
|
+
const m = meta.trim().match(
|
|
116
|
+
/^(\d{4})-(\d{1,2})-(\d{1,2})(?:\s+(\d{1,2}):(\d{1,2})(?::(\d{1,2}))?)?$/
|
|
117
|
+
);
|
|
118
|
+
if (!m) return [];
|
|
119
|
+
const parts = [Number(m[1]), Number(m[2]), Number(m[3])];
|
|
120
|
+
if (m[4] !== void 0) {
|
|
121
|
+
parts.push(Number(m[4]), Number(m[5]));
|
|
122
|
+
if (m[6] !== void 0) parts.push(Number(m[6]));
|
|
123
|
+
}
|
|
124
|
+
return parts;
|
|
125
|
+
}
|
|
126
|
+
function parseFootprintsSource(source) {
|
|
127
|
+
const normalized = source.replace(/\r\n?/g, "\n");
|
|
128
|
+
const lines = normalized.split("\n");
|
|
129
|
+
const open = _optionalChain([lines, 'access', _8 => _8[0], 'optionalAccess', _9 => _9.match, 'call', _10 => _10(/^ {0,3}:{3,}\s*footprints(?:\s+(.*))?$/i)]);
|
|
130
|
+
const times = parseFootprintsDatetime((_nullishCoalesce(_optionalChain([open, 'optionalAccess', _11 => _11[1]]), () => ( ""))).trim());
|
|
131
|
+
let end = lines.length - 1;
|
|
132
|
+
while (end > 0 && !/^ {0,3}:{3,}\s*$/.test(lines[end])) end -= 1;
|
|
133
|
+
const bodyLines = lines.slice(1, end);
|
|
134
|
+
const paragraphs = [];
|
|
135
|
+
const images = [];
|
|
136
|
+
let otherInfo = "";
|
|
137
|
+
let buf = [];
|
|
138
|
+
let inOther = false;
|
|
139
|
+
const flush = () => {
|
|
140
|
+
const text = buf.join("\n").trim();
|
|
141
|
+
buf = [];
|
|
142
|
+
if (!text) return;
|
|
143
|
+
if (inOther) {
|
|
144
|
+
otherInfo = otherInfo ? `${otherInfo}
|
|
145
|
+
${text}` : text;
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
const imgOnly = text.match(/^!\[([^\]]*)\]\(([^)\s]+)(?:\s+"[^"]*")?\)$/);
|
|
149
|
+
if (imgOnly) {
|
|
150
|
+
images.push(imgOnly[2]);
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
const parts = text.split("\n");
|
|
154
|
+
let allImg = true;
|
|
155
|
+
const blockImgs = [];
|
|
156
|
+
for (const line of parts) {
|
|
157
|
+
const m = line.trim().match(/^!\[([^\]]*)\]\(([^)\s]+)(?:\s+"[^"]*")?\)$/);
|
|
158
|
+
if (m) blockImgs.push(m[2]);
|
|
159
|
+
else if (line.trim()) {
|
|
160
|
+
allImg = false;
|
|
161
|
+
break;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
if (allImg && blockImgs.length) {
|
|
165
|
+
images.push(...blockImgs);
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
paragraphs.push(text);
|
|
169
|
+
};
|
|
170
|
+
for (const line of bodyLines) {
|
|
171
|
+
if (line.trim() === "---") {
|
|
172
|
+
flush();
|
|
173
|
+
inOther = true;
|
|
174
|
+
continue;
|
|
175
|
+
}
|
|
176
|
+
if (line.trim() === "") {
|
|
177
|
+
flush();
|
|
178
|
+
continue;
|
|
179
|
+
}
|
|
180
|
+
buf.push(line);
|
|
181
|
+
}
|
|
182
|
+
flush();
|
|
183
|
+
return { times, paragraphs, images, otherInfo };
|
|
184
|
+
}
|
|
185
|
+
|
|
128
186
|
// vitepress/configs/markdown.config.ts
|
|
129
187
|
function esc(s = "") {
|
|
130
188
|
return s.replace(
|
|
@@ -142,11 +200,14 @@ var simpleMermaidMarkdown = (md) => {
|
|
|
142
200
|
const fence = md.renderer.rules.fence ? md.renderer.rules.fence.bind(md.renderer.rules) : () => "";
|
|
143
201
|
md.renderer.rules.fence = (tokens, index, options, env, slf) => {
|
|
144
202
|
const token = tokens[index];
|
|
145
|
-
|
|
203
|
+
const parts = token.info.trim().split(/\s+/).filter(Boolean);
|
|
204
|
+
if (parts[0] === "mermaid") {
|
|
146
205
|
try {
|
|
206
|
+
const centered = parts.slice(1).some((part) => part.toLowerCase() === "center");
|
|
147
207
|
const key = `mermaid-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
|
|
148
208
|
const content = token.content;
|
|
149
|
-
|
|
209
|
+
const centerAttr = centered ? ' :center="true"' : "";
|
|
210
|
+
return `<Mermaid id="${key}" graph="${encodeURIComponent(content)}"${centerAttr} />`;
|
|
150
211
|
} catch (err) {
|
|
151
212
|
return `<pre>${err}</pre>`;
|
|
152
213
|
}
|
|
@@ -164,28 +225,14 @@ function configureMindmapFence(md) {
|
|
|
164
225
|
const info = token.info.trim();
|
|
165
226
|
const fenceOptions = parseMindmapFence(info);
|
|
166
227
|
if (!fenceOptions) return fence(tokens, index, options, env, slf);
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
const reference = parseMindmapReference(firstNonEmptyLine);
|
|
170
|
-
if (reference) {
|
|
171
|
-
const possibleRel = _optionalChain([env, 'optionalAccess', _8 => _8.relativePath]) || _optionalChain([env, 'optionalAccess', _9 => _9.path]) || _optionalChain([env, 'optionalAccess', _10 => _10.filePath]) || _optionalChain([env, 'optionalAccess', _11 => _11.file]) || "";
|
|
172
|
-
const refFullPath = _path2.default.isAbsolute(reference.path) ? reference.path : _path2.default.resolve(process.cwd(), possibleRel ? _path2.default.dirname(possibleRel) : "", reference.path);
|
|
173
|
-
try {
|
|
174
|
-
content = _fs2.default.readFileSync(refFullPath, "utf8");
|
|
175
|
-
} catch (error) {
|
|
176
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
177
|
-
content = `- Failed to load referenced file: ${reference.path}
|
|
178
|
-
- Error: ${message}`;
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
content = normalizeMindmapMarkdown(content, {
|
|
182
|
-
title: fenceOptions.title || _optionalChain([reference, 'optionalAccess', _12 => _12.title])
|
|
228
|
+
const content = normalizeMindmapMarkdown(token.content, {
|
|
229
|
+
title: fenceOptions.title
|
|
183
230
|
});
|
|
184
231
|
const props = [
|
|
185
232
|
`content="${encodeURIComponent(content.trim())}"`,
|
|
186
233
|
fenceOptions.initialExpandLevel === void 0 ? "" : `:initialExpandLevel="${fenceOptions.initialExpandLevel}"`
|
|
187
234
|
].filter(Boolean).join(" ");
|
|
188
|
-
return `<
|
|
235
|
+
return `<Mindmap ${props}></Mindmap>
|
|
189
236
|
`;
|
|
190
237
|
};
|
|
191
238
|
}
|
|
@@ -247,6 +294,114 @@ function configureSwiperContainer(md) {
|
|
|
247
294
|
}
|
|
248
295
|
});
|
|
249
296
|
}
|
|
297
|
+
function escapeHtmlText(s) {
|
|
298
|
+
return s.replace(
|
|
299
|
+
/[&<>"']/g,
|
|
300
|
+
(ch) => ({ "&": "&", "<": "<", ">": ">", '"': """, "'": "'" })[ch]
|
|
301
|
+
);
|
|
302
|
+
}
|
|
303
|
+
function extractFootprintsPayloadFromTokens(tokens, idx) {
|
|
304
|
+
const meta = String(tokens[idx].info || "").trim().replace(/^footprints\s*/i, "");
|
|
305
|
+
const times = parseFootprintsDatetime(meta);
|
|
306
|
+
const paragraphs = [];
|
|
307
|
+
const images = [];
|
|
308
|
+
let otherInfo = "";
|
|
309
|
+
let inOther = false;
|
|
310
|
+
for (let i = idx + 1; i < tokens.length; i++) {
|
|
311
|
+
const t = tokens[i];
|
|
312
|
+
if (t.type === "container_footprints_close") break;
|
|
313
|
+
if (t.type !== "inline") continue;
|
|
314
|
+
const childImgs = [];
|
|
315
|
+
if (Array.isArray(t.children)) {
|
|
316
|
+
for (const c of t.children) {
|
|
317
|
+
if (c.type === "image") {
|
|
318
|
+
const src = _optionalChain([c, 'access', _12 => _12.attrGet, 'optionalCall', _13 => _13("src")]) || _optionalChain([c, 'access', _14 => _14.attrs, 'optionalAccess', _15 => _15.find, 'call', _16 => _16((a) => a[0] === "src"), 'optionalAccess', _17 => _17[1]]);
|
|
319
|
+
if (src) childImgs.push(src);
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
const content = String(t.content || "").trim();
|
|
324
|
+
if (content === "---") {
|
|
325
|
+
inOther = true;
|
|
326
|
+
continue;
|
|
327
|
+
}
|
|
328
|
+
if (childImgs.length) {
|
|
329
|
+
const withoutImgs = content.replace(/!\[[^\]]*\]\([^)]+\)/g, "").trim();
|
|
330
|
+
if (!withoutImgs) {
|
|
331
|
+
images.push(...childImgs);
|
|
332
|
+
continue;
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
const imgOnly = content.match(/^!\[([^\]]*)\]\(([^)\s]+)(?:\s+"[^"]*")?\)$/);
|
|
336
|
+
if (imgOnly) {
|
|
337
|
+
images.push(imgOnly[2]);
|
|
338
|
+
continue;
|
|
339
|
+
}
|
|
340
|
+
if (!content) continue;
|
|
341
|
+
if (inOther) otherInfo = otherInfo ? `${otherInfo}
|
|
342
|
+
${content}` : content;
|
|
343
|
+
else paragraphs.push(content);
|
|
344
|
+
}
|
|
345
|
+
return { times, paragraphs, images, otherInfo };
|
|
346
|
+
}
|
|
347
|
+
function configureFootprintsContainer(md) {
|
|
348
|
+
md.use(_markdownitcontainer2.default, "footprints", {
|
|
349
|
+
validate: (params) => /^footprints(\s|$)/i.test(params.trim()),
|
|
350
|
+
render: (tokens, idx, _opts, env) => {
|
|
351
|
+
if (tokens[idx].nesting !== 1) return "";
|
|
352
|
+
let payload = extractFootprintsPayloadFromTokens(tokens, idx);
|
|
353
|
+
const startLine = _nullishCoalesce(_optionalChain([tokens, 'access', _18 => _18[idx], 'access', _19 => _19.map, 'optionalAccess', _20 => _20[0]]), () => ( 0));
|
|
354
|
+
let endLine = startLine;
|
|
355
|
+
for (let i = idx + 1; i < tokens.length; i++) {
|
|
356
|
+
if (tokens[i].type === "container_footprints_close") {
|
|
357
|
+
endLine = _nullishCoalesce(_optionalChain([tokens, 'access', _21 => _21[i], 'access', _22 => _22.map, 'optionalAccess', _23 => _23[0]]), () => ( endLine));
|
|
358
|
+
break;
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
const raw = String(_nullishCoalesce(_nullishCoalesce(_optionalChain([env, 'optionalAccess', _24 => _24.src]), () => ( _optionalChain([env, 'optionalAccess', _25 => _25.source]))), () => ( "")));
|
|
362
|
+
if (raw && endLine > startLine) {
|
|
363
|
+
const slice = raw.split(/\r?\n/).slice(startLine, endLine + 1).join("\n");
|
|
364
|
+
const fromSource = parseFootprintsSource(
|
|
365
|
+
slice.includes(":::") ? slice : `::: ${tokens[idx].info}
|
|
366
|
+
${slice}
|
|
367
|
+
:::`
|
|
368
|
+
);
|
|
369
|
+
if (!payload.paragraphs.length && fromSource.paragraphs.length) {
|
|
370
|
+
payload = { ...payload, paragraphs: fromSource.paragraphs };
|
|
371
|
+
}
|
|
372
|
+
if (!payload.images.length && fromSource.images.length) {
|
|
373
|
+
payload = { ...payload, images: fromSource.images };
|
|
374
|
+
}
|
|
375
|
+
if (!payload.otherInfo && fromSource.otherInfo) {
|
|
376
|
+
payload = { ...payload, otherInfo: fromSource.otherInfo };
|
|
377
|
+
}
|
|
378
|
+
if (!payload.times.length && fromSource.times.length) {
|
|
379
|
+
payload = { ...payload, times: fromSource.times };
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
for (let i = idx + 1; i < tokens.length; i++) {
|
|
383
|
+
if (tokens[i].type === "container_footprints_close") break;
|
|
384
|
+
tokens[i].hidden = true;
|
|
385
|
+
tokens[i].content = "";
|
|
386
|
+
if (Array.isArray(tokens[i].children)) {
|
|
387
|
+
for (const child of tokens[i].children) {
|
|
388
|
+
child.hidden = true;
|
|
389
|
+
child.content = "";
|
|
390
|
+
}
|
|
391
|
+
tokens[i].children = [];
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
const enc = (value) => encodeURIComponent(JSON.stringify(value)).replace(/'/g, "%27");
|
|
395
|
+
const bindExpr = (value) => "JSON.parse(decodeURIComponent('" + enc(value) + "'))";
|
|
396
|
+
const imageSlot = payload.images.map((src, i) => {
|
|
397
|
+
return '<img src="' + escapeHtmlText(src) + '" @click="openModal(' + String(i) + ')" />';
|
|
398
|
+
}).join("\n");
|
|
399
|
+
const openTag = '<Footprints :times="' + bindExpr(payload.times) + '" :paragraphs="' + bindExpr(payload.paragraphs) + '" :other-info="' + bindExpr(payload.otherInfo) + '">';
|
|
400
|
+
if (!payload.images.length) return openTag + "</Footprints>\n";
|
|
401
|
+
return openTag + '\n<template #image-list="{ openModal }">\n' + imageSlot + "\n</template>\n</Footprints>\n";
|
|
402
|
+
}
|
|
403
|
+
});
|
|
404
|
+
}
|
|
250
405
|
function getMarkdownConfig() {
|
|
251
406
|
const markdown = {
|
|
252
407
|
lineNumbers: true,
|
|
@@ -266,6 +421,7 @@ function getMarkdownConfig() {
|
|
|
266
421
|
}
|
|
267
422
|
});
|
|
268
423
|
configureSwiperContainer(md);
|
|
424
|
+
configureFootprintsContainer(md);
|
|
269
425
|
},
|
|
270
426
|
anchor: {
|
|
271
427
|
slugify: _chunk7FEANCT6cjs.generateAnchor
|
|
@@ -501,7 +657,7 @@ function buildProgressPlugin(options = {}) {
|
|
|
501
657
|
globalLastOutputTime = 0;
|
|
502
658
|
globalTransformEndTime = 0;
|
|
503
659
|
globalLastHookTime = Date.now();
|
|
504
|
-
globalOutDir = _optionalChain([config, 'access',
|
|
660
|
+
globalOutDir = _optionalChain([config, 'access', _26 => _26.build, 'optionalAccess', _27 => _27.outDir]) || "dist";
|
|
505
661
|
interceptOutput();
|
|
506
662
|
globalStallTimer = setInterval(() => {
|
|
507
663
|
if (!globalIsBuilding || globalLastPercent <= 0 || globalLastPercent >= 0.98)
|
|
@@ -674,7 +830,7 @@ function getNoteByConfigIdPlugin() {
|
|
|
674
830
|
name: "tnotes-get-note-by-config-id",
|
|
675
831
|
configureServer(server) {
|
|
676
832
|
server.middlewares.use(async (req, res, next) => {
|
|
677
|
-
if (_optionalChain([req, 'access',
|
|
833
|
+
if (_optionalChain([req, 'access', _28 => _28.url, 'optionalAccess', _29 => _29.startsWith, 'call', _30 => _30("/__tnotes_get_note?")]) && req.method === "GET") {
|
|
678
834
|
try {
|
|
679
835
|
const url = new URL(req.url, `http://${req.headers.host}`);
|
|
680
836
|
const configId = url.searchParams.get("configId");
|
|
@@ -784,7 +940,7 @@ function getDocIdFromFile(input) {
|
|
|
784
940
|
) ? _path2.default.win32 : _path2.default;
|
|
785
941
|
const absoluteFile = pathApi.isAbsolute(input.absoluteOrRelativeFile) ? input.absoluteOrRelativeFile : pathApi.join(input.srcDir, input.absoluteOrRelativeFile);
|
|
786
942
|
let relFile = slash(pathApi.relative(input.srcDir, absoluteFile));
|
|
787
|
-
if (_optionalChain([input, 'access',
|
|
943
|
+
if (_optionalChain([input, 'access', _31 => _31.rewrites, 'optionalAccess', _32 => _32[relFile]])) {
|
|
788
944
|
relFile = input.rewrites[relFile];
|
|
789
945
|
}
|
|
790
946
|
let id = slash(_path2.default.posix.join(input.base, relFile));
|
|
@@ -813,8 +969,8 @@ function* splitPageIntoSections(html) {
|
|
|
813
969
|
const level = parseInt(result[i], 10) - 1;
|
|
814
970
|
const heading = result[i + 1];
|
|
815
971
|
const headingResult = headingContentRegex.exec(heading);
|
|
816
|
-
const title = clearHtmlTags(_nullishCoalesce(_optionalChain([headingResult, 'optionalAccess',
|
|
817
|
-
const anchor = _nullishCoalesce(_optionalChain([headingResult, 'optionalAccess',
|
|
972
|
+
const title = clearHtmlTags(_nullishCoalesce(_optionalChain([headingResult, 'optionalAccess', _33 => _33[1]]), () => ( ""))).trim();
|
|
973
|
+
const anchor = _nullishCoalesce(_optionalChain([headingResult, 'optionalAccess', _34 => _34[2]]), () => ( ""));
|
|
818
974
|
const content = result[i + 2];
|
|
819
975
|
if (!title || !content) continue;
|
|
820
976
|
let titles = parentTitles.slice(0, level);
|
|
@@ -837,7 +993,7 @@ function getLocaleForPath(site, page) {
|
|
|
837
993
|
if (normalizedPage.startsWith(normalizedPrefix)) {
|
|
838
994
|
return localePath;
|
|
839
995
|
}
|
|
840
|
-
if (_optionalChain([localeConfig, 'optionalAccess',
|
|
996
|
+
if (_optionalChain([localeConfig, 'optionalAccess', _35 => _35.lang]) && normalizedPage === prefix.replace(/\/$/, "")) {
|
|
841
997
|
return localePath;
|
|
842
998
|
}
|
|
843
999
|
}
|
|
@@ -861,13 +1017,13 @@ async function renderPageHtml(siteConfig, md, absoluteFile) {
|
|
|
861
1017
|
cleanUrls: _nullishCoalesce(siteConfig.cleanUrls, () => ( false)),
|
|
862
1018
|
frontmatter: {}
|
|
863
1019
|
};
|
|
864
|
-
const options = _nullishCoalesce(_optionalChain([siteConfig, 'access',
|
|
1020
|
+
const options = _nullishCoalesce(_optionalChain([siteConfig, 'access', _36 => _36.site, 'access', _37 => _37.themeConfig, 'optionalAccess', _38 => _38.search, 'optionalAccess', _39 => _39.options]), () => ( {}));
|
|
865
1021
|
const mdRaw = await _promises2.default.readFile(absoluteFile, "utf-8");
|
|
866
1022
|
if (options._render) {
|
|
867
1023
|
return await options._render(mdRaw, env, md);
|
|
868
1024
|
}
|
|
869
1025
|
const html = md.render(mdRaw, env);
|
|
870
|
-
return _optionalChain([env, 'access',
|
|
1026
|
+
return _optionalChain([env, 'access', _40 => _40.frontmatter, 'optionalAccess', _41 => _41.search]) === false ? "" : html;
|
|
871
1027
|
}
|
|
872
1028
|
async function indexPage(siteConfig, md, page, index) {
|
|
873
1029
|
const absoluteFile = _path2.default.join(siteConfig.srcDir, page);
|
|
@@ -899,7 +1055,7 @@ async function buildLocalSearchIndexSnapshot(siteConfig, md) {
|
|
|
899
1055
|
siteConfig.userConfig,
|
|
900
1056
|
siteConfig.logger
|
|
901
1057
|
);
|
|
902
|
-
const options = _nullishCoalesce(_optionalChain([siteConfig, 'access',
|
|
1058
|
+
const options = _nullishCoalesce(_optionalChain([siteConfig, 'access', _42 => _42.site, 'access', _43 => _43.themeConfig, 'optionalAccess', _44 => _44.search, 'optionalAccess', _45 => _45.options]), () => ( {}));
|
|
903
1059
|
const indexByLocale = /* @__PURE__ */ new Map();
|
|
904
1060
|
for (const page of pages) {
|
|
905
1061
|
const locale = getLocaleForPath(siteConfig.site, page);
|
|
@@ -908,7 +1064,7 @@ async function buildLocalSearchIndexSnapshot(siteConfig, md) {
|
|
|
908
1064
|
index = new (0, _minisearch2.default)({
|
|
909
1065
|
fields: ["title", "titles", "text"],
|
|
910
1066
|
storeFields: ["title", "titles"],
|
|
911
|
-
..._optionalChain([options, 'access',
|
|
1067
|
+
..._optionalChain([options, 'access', _46 => _46.miniSearch, 'optionalAccess', _47 => _47.options])
|
|
912
1068
|
});
|
|
913
1069
|
indexByLocale.set(locale, index);
|
|
914
1070
|
}
|
|
@@ -1256,10 +1412,10 @@ function buildNoteReadmeLink(dirName) {
|
|
|
1256
1412
|
async function withSuspendedWatcher(task) {
|
|
1257
1413
|
const watcher = _chunkBL22KD4Vcjs.FileWatcherService.getInstance();
|
|
1258
1414
|
try {
|
|
1259
|
-
_optionalChain([watcher, 'optionalAccess',
|
|
1415
|
+
_optionalChain([watcher, 'optionalAccess', _48 => _48.suspend, 'call', _49 => _49()]);
|
|
1260
1416
|
return await task();
|
|
1261
1417
|
} finally {
|
|
1262
|
-
_optionalChain([watcher, 'optionalAccess',
|
|
1418
|
+
_optionalChain([watcher, 'optionalAccess', _50 => _50.unsuspend, 'call', _51 => _51()]);
|
|
1263
1419
|
}
|
|
1264
1420
|
}
|
|
1265
1421
|
function collectRefs(snapshot) {
|
|
@@ -1314,14 +1470,14 @@ function isNoteInSubtree(snapshot, lineIndex, noteIndex) {
|
|
|
1314
1470
|
}
|
|
1315
1471
|
function folderPathAtLine(snapshot, lineIndex) {
|
|
1316
1472
|
const result = [];
|
|
1317
|
-
const walk = (nodes,
|
|
1473
|
+
const walk = (nodes, path5) => {
|
|
1318
1474
|
for (const node of nodes) {
|
|
1319
1475
|
if (node.kind === "folder") {
|
|
1320
1476
|
if (node.tocLineIndex === lineIndex) {
|
|
1321
|
-
result.push(...[...
|
|
1477
|
+
result.push(...[...path5, node.title]);
|
|
1322
1478
|
return true;
|
|
1323
1479
|
}
|
|
1324
|
-
if (walk(node.children, [...
|
|
1480
|
+
if (walk(node.children, [...path5, node.title])) return true;
|
|
1325
1481
|
}
|
|
1326
1482
|
}
|
|
1327
1483
|
return false;
|
|
@@ -1375,7 +1531,7 @@ function sidebarStructurePlugin() {
|
|
|
1375
1531
|
});
|
|
1376
1532
|
await refreshTocAndSidebar();
|
|
1377
1533
|
scheduleNoteSearchReindex("api:delete-note");
|
|
1378
|
-
const redirectDir = previous ? _optionalChain([snapshot, 'access',
|
|
1534
|
+
const redirectDir = previous ? _optionalChain([snapshot, 'access', _52 => _52.notes, 'access', _53 => _53.find, 'call', _54 => _54((item) => item.index === previous), 'optionalAccess', _55 => _55.dirName]) : void 0;
|
|
1379
1535
|
return {
|
|
1380
1536
|
success: true,
|
|
1381
1537
|
sidebarChanged: true,
|
|
@@ -1404,7 +1560,7 @@ function sidebarStructurePlugin() {
|
|
|
1404
1560
|
});
|
|
1405
1561
|
await refreshTocAndSidebar();
|
|
1406
1562
|
scheduleNoteSearchReindex("api:delete-entry");
|
|
1407
|
-
const redirectDir = inSubtree && previous ? _optionalChain([snapshot, 'access',
|
|
1563
|
+
const redirectDir = inSubtree && previous ? _optionalChain([snapshot, 'access', _56 => _56.notes, 'access', _57 => _57.find, 'call', _58 => _58((item) => item.index === previous), 'optionalAccess', _59 => _59.dirName]) : void 0;
|
|
1408
1564
|
return {
|
|
1409
1565
|
success: true,
|
|
1410
1566
|
sidebarChanged: true,
|
|
@@ -1671,7 +1827,7 @@ function defineNotesConfig(overrides = {}) {
|
|
|
1671
1827
|
getNoteByConfigIdPlugin(),
|
|
1672
1828
|
fileWatcherBridgePlugin(),
|
|
1673
1829
|
localSearchReindexPlugin(),
|
|
1674
|
-
..._optionalChain([overrideVite, 'optionalAccess',
|
|
1830
|
+
..._optionalChain([overrideVite, 'optionalAccess', _60 => _60.plugins]) || []
|
|
1675
1831
|
],
|
|
1676
1832
|
server: {
|
|
1677
1833
|
// 显式同时监听 IPv4 / IPv6,避免 Node 18+ 在 Windows 下偶发只绑定 ::1
|
|
@@ -1680,7 +1836,7 @@ function defineNotesConfig(overrides = {}) {
|
|
|
1680
1836
|
watch: {
|
|
1681
1837
|
ignored: IGNORE_LIST
|
|
1682
1838
|
},
|
|
1683
|
-
..._optionalChain([overrideVite, 'optionalAccess',
|
|
1839
|
+
..._optionalChain([overrideVite, 'optionalAccess', _61 => _61.server])
|
|
1684
1840
|
},
|
|
1685
1841
|
css: {
|
|
1686
1842
|
preprocessorOptions: {
|
|
@@ -1688,26 +1844,26 @@ function defineNotesConfig(overrides = {}) {
|
|
|
1688
1844
|
silenceDeprecations: ["legacy-js-api"]
|
|
1689
1845
|
}
|
|
1690
1846
|
},
|
|
1691
|
-
..._optionalChain([overrideVite, 'optionalAccess',
|
|
1847
|
+
..._optionalChain([overrideVite, 'optionalAccess', _62 => _62.css])
|
|
1692
1848
|
},
|
|
1693
1849
|
build: {
|
|
1694
1850
|
chunkSizeWarningLimit: 1e3,
|
|
1695
|
-
..._optionalChain([overrideVite, 'optionalAccess',
|
|
1851
|
+
..._optionalChain([overrideVite, 'optionalAccess', _63 => _63.build])
|
|
1696
1852
|
},
|
|
1697
1853
|
define: {
|
|
1698
1854
|
__TNOTES_REPO_NAME__: JSON.stringify(config.repoName),
|
|
1699
1855
|
__TNOTES_AUTHOR__: JSON.stringify(config.author),
|
|
1700
1856
|
__TNOTES_IGNORE_DIRS__: JSON.stringify(config.ignore_dirs),
|
|
1701
1857
|
__TNOTES_ROOT_ITEM__: JSON.stringify(config.root_item),
|
|
1702
|
-
..._optionalChain([overrideVite, 'optionalAccess',
|
|
1858
|
+
..._optionalChain([overrideVite, 'optionalAccess', _64 => _64.define])
|
|
1703
1859
|
},
|
|
1704
1860
|
resolve: {
|
|
1705
1861
|
dedupe: ["vue", "vitepress"],
|
|
1706
|
-
..._optionalChain([overrideVite, 'optionalAccess',
|
|
1862
|
+
..._optionalChain([overrideVite, 'optionalAccess', _65 => _65.resolve])
|
|
1707
1863
|
},
|
|
1708
1864
|
optimizeDeps: {
|
|
1709
1865
|
include: [...DEFAULT_OPTIMIZE_DEPS_INCLUDE],
|
|
1710
|
-
..._optionalChain([overrideVite, 'optionalAccess',
|
|
1866
|
+
..._optionalChain([overrideVite, 'optionalAccess', _66 => _66.optimizeDeps])
|
|
1711
1867
|
}
|
|
1712
1868
|
},
|
|
1713
1869
|
transformPageData(pageData, ctx) {
|