@mvarble/mesearch-cms 0.1.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/LICENSE +21 -0
- package/README.md +53 -0
- package/dist/cms.d.ts +22 -0
- package/dist/cms.js +270 -0
- package/dist/cms.js.map +1 -0
- package/dist/core/bibtex.d.ts +6 -0
- package/dist/core/bibtex.js +129 -0
- package/dist/core/bibtex.js.map +1 -0
- package/dist/core/build.d.ts +29 -0
- package/dist/core/build.js +41 -0
- package/dist/core/build.js.map +1 -0
- package/dist/core/facts.d.ts +4 -0
- package/dist/core/facts.js +39 -0
- package/dist/core/facts.js.map +1 -0
- package/dist/core/frontmatter.d.ts +26 -0
- package/dist/core/frontmatter.js +134 -0
- package/dist/core/frontmatter.js.map +1 -0
- package/dist/core/paths.d.ts +4 -0
- package/dist/core/paths.js +17 -0
- package/dist/core/paths.js.map +1 -0
- package/dist/core/resolver.d.ts +33 -0
- package/dist/core/resolver.js +45 -0
- package/dist/core/resolver.js.map +1 -0
- package/dist/core/scopes.d.ts +9 -0
- package/dist/core/scopes.js +29 -0
- package/dist/core/scopes.js.map +1 -0
- package/dist/core/source.d.ts +15 -0
- package/dist/core/source.js +68 -0
- package/dist/core/source.js.map +1 -0
- package/dist/core/statements.d.ts +18 -0
- package/dist/core/statements.js +65 -0
- package/dist/core/statements.js.map +1 -0
- package/dist/core/store.d.ts +67 -0
- package/dist/core/store.js +115 -0
- package/dist/core/store.js.map +1 -0
- package/dist/core/walk.d.ts +19 -0
- package/dist/core/walk.js +122 -0
- package/dist/core/walk.js.map +1 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.js +14 -0
- package/dist/index.js.map +1 -0
- package/dist/model/build.d.ts +13 -0
- package/dist/model/build.js +67 -0
- package/dist/model/build.js.map +1 -0
- package/dist/model/index.d.ts +2 -0
- package/dist/model/index.js +3 -0
- package/dist/model/index.js.map +1 -0
- package/dist/model/outline.d.ts +11 -0
- package/dist/model/outline.js +51 -0
- package/dist/model/outline.js.map +1 -0
- package/dist/presets/blog/index.d.ts +9 -0
- package/dist/presets/blog/index.js +346 -0
- package/dist/presets/blog/index.js.map +1 -0
- package/dist/presets/blog/runtime.d.ts +60 -0
- package/dist/presets/blog/runtime.js +55 -0
- package/dist/presets/blog/runtime.js.map +1 -0
- package/dist/presets/blog/types.d.ts +48 -0
- package/dist/presets/blog/types.js +2 -0
- package/dist/presets/blog/types.js.map +1 -0
- package/dist/presets/mesearch/dates.d.ts +6 -0
- package/dist/presets/mesearch/dates.js +100 -0
- package/dist/presets/mesearch/dates.js.map +1 -0
- package/dist/presets/mesearch/index.d.ts +13 -0
- package/dist/presets/mesearch/index.js +407 -0
- package/dist/presets/mesearch/index.js.map +1 -0
- package/dist/presets/mesearch/runtime.d.ts +56 -0
- package/dist/presets/mesearch/runtime.js +57 -0
- package/dist/presets/mesearch/runtime.js.map +1 -0
- package/dist/presets/mesearch/types.d.ts +46 -0
- package/dist/presets/mesearch/types.js +8 -0
- package/dist/presets/mesearch/types.js.map +1 -0
- package/dist/resolvers/citation.d.ts +38 -0
- package/dist/resolvers/citation.js +60 -0
- package/dist/resolvers/citation.js.map +1 -0
- package/dist/resolvers/equation.d.ts +12 -0
- package/dist/resolvers/equation.js +52 -0
- package/dist/resolvers/equation.js.map +1 -0
- package/dist/resolvers/index.d.ts +4 -0
- package/dist/resolvers/index.js +5 -0
- package/dist/resolvers/index.js.map +1 -0
- package/dist/resolvers/page.d.ts +18 -0
- package/dist/resolvers/page.js +61 -0
- package/dist/resolvers/page.js.map +1 -0
- package/dist/resolvers/statement.d.ts +13 -0
- package/dist/resolvers/statement.js +45 -0
- package/dist/resolvers/statement.js.map +1 -0
- package/dist/runtime.d.ts +1 -0
- package/dist/runtime.js +20 -0
- package/dist/runtime.js.map +1 -0
- package/package.json +80 -0
|
@@ -0,0 +1,346 @@
|
|
|
1
|
+
import { docRecord } from "../../core/build.js";
|
|
2
|
+
import { Frontmatter } from "../../core/frontmatter.js";
|
|
3
|
+
import { resolveId } from "../../core/paths.js";
|
|
4
|
+
import { bibliographies, readBibliography } from "../../core/bibtex.js";
|
|
5
|
+
import { registerStatement } from "../../core/statements.js";
|
|
6
|
+
import { parseHeadings, walkDocument } from "../../core/walk.js";
|
|
7
|
+
import { labelPages, Numbering } from "../../model/build.js";
|
|
8
|
+
import { citations, equations, pathnameLinks, statements, TAG, } from "../../resolvers/index.js";
|
|
9
|
+
// The blog's content model.
|
|
10
|
+
//
|
|
11
|
+
// - `type: post` is a page at `posts/<slug>`.
|
|
12
|
+
// - `type: sequence` is a page at `sequences/<slug>` with a tree of chapter and
|
|
13
|
+
// section pages beneath it, labelled by position when `enumerate` is set.
|
|
14
|
+
// - `type: statement` is a theorem, lemma or the like, rendered inside the page
|
|
15
|
+
// that imports it and numbered with the equations around it.
|
|
16
|
+
// - `.bib` files are the bibliography that `cite:` links draw from. A
|
|
17
|
+
// citation points at the reference list at the end of the page it is on,
|
|
18
|
+
// which holds exactly what that page cites.
|
|
19
|
+
//
|
|
20
|
+
// Statements and equations share one counter per post, or per sequence, and
|
|
21
|
+
// their slugs are unique within it.
|
|
22
|
+
export function blogPreset(options = {}) {
|
|
23
|
+
const contentDir = options.contentDir ?? 'content';
|
|
24
|
+
const statementComponent = options.statementComponent ?? '$lib/components/statement.svelte';
|
|
25
|
+
const statementComponentFile = options.statementComponentFile ?? 'src/lib/components/statement.svelte';
|
|
26
|
+
const isComponent = (specifier, from) => specifier == statementComponent ||
|
|
27
|
+
(specifier.startsWith('.') && resolveId(from, specifier) == statementComponentFile);
|
|
28
|
+
// Walks a page --- and every statement it imports, recursively --- handing
|
|
29
|
+
// out labels from `numbering` in reading order.
|
|
30
|
+
function walk(store, file, target, numbering) {
|
|
31
|
+
const walkOptions = {
|
|
32
|
+
isComponent,
|
|
33
|
+
onMath(tex, at) {
|
|
34
|
+
for (const [, slug] of tex.matchAll(TAG)) {
|
|
35
|
+
store.addAnchor({
|
|
36
|
+
kind: 'equation',
|
|
37
|
+
scope: at.scope,
|
|
38
|
+
slug: slug,
|
|
39
|
+
label: numbering.next(),
|
|
40
|
+
source: at.doc,
|
|
41
|
+
page: at.page,
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
onImport(id, at) {
|
|
46
|
+
registerStatement(store, id, at, {
|
|
47
|
+
next: () => numbering.next(),
|
|
48
|
+
walk: (file, target) => walk(store, file, target, numbering),
|
|
49
|
+
});
|
|
50
|
+
},
|
|
51
|
+
};
|
|
52
|
+
walkDocument(file, target, walkOptions);
|
|
53
|
+
}
|
|
54
|
+
const post = {
|
|
55
|
+
name: 'post',
|
|
56
|
+
claims: (file) => file.frontmatter.type == 'post',
|
|
57
|
+
initialize(store, file) {
|
|
58
|
+
const fm = new Frontmatter(store.root, file.id, file.frontmatter, 'Post');
|
|
59
|
+
const created = fm.requiredDate('created');
|
|
60
|
+
const slug = fm.slug();
|
|
61
|
+
const post = {
|
|
62
|
+
title: fm.requiredString('title'),
|
|
63
|
+
slug,
|
|
64
|
+
created,
|
|
65
|
+
edited: fm.optionalDate('edited', created),
|
|
66
|
+
pathname: `posts/${slug}`,
|
|
67
|
+
filename: file.id,
|
|
68
|
+
descriptionFilename: fm.optionalPath('description'),
|
|
69
|
+
imageFilename: fm.optionalPath('image'),
|
|
70
|
+
katexMacros: fm.katexMacros(),
|
|
71
|
+
tags: fm.optionalStrings('tags') ?? [],
|
|
72
|
+
};
|
|
73
|
+
if (!report(store, fm))
|
|
74
|
+
return;
|
|
75
|
+
store.addDoc(docRecord(file.id, 'post', {
|
|
76
|
+
macros: post.katexMacros,
|
|
77
|
+
headings: parseHeadings(file, { depth: 2 }),
|
|
78
|
+
}));
|
|
79
|
+
store.addPage({
|
|
80
|
+
pathname: post.pathname,
|
|
81
|
+
doc: file.id,
|
|
82
|
+
formats: { title: post.title, full: post.title },
|
|
83
|
+
});
|
|
84
|
+
registerScope(store, slug, file.id, `post '${slug}'`);
|
|
85
|
+
registerDescription(store, post.descriptionFilename, file.id);
|
|
86
|
+
store.collection('posts').set(slug, post);
|
|
87
|
+
walk(store, file, { doc: file.id, scope: file.id, page: post.pathname, host: file.id }, new Numbering());
|
|
88
|
+
},
|
|
89
|
+
};
|
|
90
|
+
const sequence = {
|
|
91
|
+
name: 'sequence',
|
|
92
|
+
claims: (file) => file.frontmatter.type == 'sequence',
|
|
93
|
+
initialize(store, file) {
|
|
94
|
+
const fm = new Frontmatter(store.root, file.id, file.frontmatter, 'Sequence');
|
|
95
|
+
const created = fm.requiredDate('created');
|
|
96
|
+
const enumerate = fm.optionalBoolean('enumerate', false);
|
|
97
|
+
// `children` is a tree of pages, each described by a file the
|
|
98
|
+
// sequence points at; a page's own frontmatter supplies its title
|
|
99
|
+
// and slug.
|
|
100
|
+
const declared = fm.optionalArray('children');
|
|
101
|
+
const children = declared
|
|
102
|
+
? buildChildren(store, file.id, declared, false, true)
|
|
103
|
+
: undefined;
|
|
104
|
+
if (declared && !children)
|
|
105
|
+
return;
|
|
106
|
+
const slug = fm.slug();
|
|
107
|
+
const pathname = `sequences/${slug}`;
|
|
108
|
+
const root = {
|
|
109
|
+
title: fm.requiredString('title'),
|
|
110
|
+
slug,
|
|
111
|
+
created,
|
|
112
|
+
edited: fm.optionalDate('edited', created),
|
|
113
|
+
pathname,
|
|
114
|
+
filename: file.id,
|
|
115
|
+
descriptionFilename: fm.optionalPath('description'),
|
|
116
|
+
imageFilename: fm.optionalPath('image'),
|
|
117
|
+
katexMacros: fm.katexMacros(),
|
|
118
|
+
tags: fm.optionalStrings('tags') ?? [],
|
|
119
|
+
enumerate,
|
|
120
|
+
children: [],
|
|
121
|
+
};
|
|
122
|
+
if (!report(store, fm))
|
|
123
|
+
return;
|
|
124
|
+
store.addDoc(docRecord(file.id, 'sequence', {
|
|
125
|
+
macros: root.katexMacros,
|
|
126
|
+
headings: parseHeadings(file, { depth: 2 }),
|
|
127
|
+
}));
|
|
128
|
+
store.addPage({
|
|
129
|
+
pathname,
|
|
130
|
+
doc: file.id,
|
|
131
|
+
formats: { title: root.title, label: '', sequence: root.title, full: root.title },
|
|
132
|
+
});
|
|
133
|
+
registerScope(store, slug, file.id, `sequence '${slug}'`);
|
|
134
|
+
registerDescription(store, root.descriptionFilename, file.id);
|
|
135
|
+
// Labels are worked out for the whole tree up front; an unenumerated
|
|
136
|
+
// sequence computes them all the same and simply does not show them.
|
|
137
|
+
const labels = labelPages(children ?? []);
|
|
138
|
+
const register = (input, parent) => {
|
|
139
|
+
const label = labels.get(input);
|
|
140
|
+
const childPathname = `${parent.pathname}/${input.slug}`;
|
|
141
|
+
const child = {
|
|
142
|
+
title: input.title,
|
|
143
|
+
slug: input.slug,
|
|
144
|
+
pathname: childPathname,
|
|
145
|
+
filename: input.filename,
|
|
146
|
+
katexMacros: input.katexMacros,
|
|
147
|
+
label: enumerate ? label : undefined,
|
|
148
|
+
appendix: input.appendix,
|
|
149
|
+
children: [],
|
|
150
|
+
};
|
|
151
|
+
// Every page of a sequence has the sequence root as its scope,
|
|
152
|
+
// which is what makes a slug mean the same thing across the
|
|
153
|
+
// whole sequence; its macros fold down from the page above.
|
|
154
|
+
store.addDoc(docRecord(input.filename, 'sequence-page', {
|
|
155
|
+
scope: file.id,
|
|
156
|
+
macroParent: parent.id,
|
|
157
|
+
macros: input.katexMacros,
|
|
158
|
+
headings: parseHeadings(store.file(input.filename), { depth: 2 }),
|
|
159
|
+
}));
|
|
160
|
+
store.addPage({
|
|
161
|
+
pathname: childPathname,
|
|
162
|
+
doc: input.filename,
|
|
163
|
+
formats: {
|
|
164
|
+
title: child.title,
|
|
165
|
+
...(child.label !== undefined ? { label: child.label } : {}),
|
|
166
|
+
sequence: root.title,
|
|
167
|
+
full: child.label ? `${child.label}. ${child.title}` : child.title,
|
|
168
|
+
},
|
|
169
|
+
});
|
|
170
|
+
child.children = (input.children ?? []).map((grandchild) => register(grandchild, { id: input.filename, pathname: childPathname }));
|
|
171
|
+
return child;
|
|
172
|
+
};
|
|
173
|
+
root.children = (children ?? []).map((child) => register(child, { id: file.id, pathname }));
|
|
174
|
+
store.collection('sequences').set(slug, root);
|
|
175
|
+
// Walks the sequence in reading order, numbering its statements and
|
|
176
|
+
// equations as it goes. `Numbering` owns when the count restarts;
|
|
177
|
+
// this only has to visit the pages in the order a reader meets them.
|
|
178
|
+
const numbering = new Numbering(enumerate ? '0' : undefined);
|
|
179
|
+
walk(store, file, { doc: file.id, scope: file.id, page: pathname, host: file.id }, numbering);
|
|
180
|
+
const descendants = root.children.toReversed();
|
|
181
|
+
while (descendants.length > 0) {
|
|
182
|
+
const descendant = descendants.pop();
|
|
183
|
+
numbering.enter(descendant.label);
|
|
184
|
+
walk(store, store.file(descendant.filename), {
|
|
185
|
+
doc: descendant.filename,
|
|
186
|
+
scope: file.id,
|
|
187
|
+
page: descendant.pathname,
|
|
188
|
+
host: descendant.filename,
|
|
189
|
+
}, numbering);
|
|
190
|
+
descendants.push(...descendant.children.toReversed());
|
|
191
|
+
}
|
|
192
|
+
},
|
|
193
|
+
};
|
|
194
|
+
// Statements register themselves when a page imports them; on their own
|
|
195
|
+
// they contribute nothing.
|
|
196
|
+
const statement = {
|
|
197
|
+
name: 'statement',
|
|
198
|
+
claims: (file) => file.frontmatter.type == 'statement',
|
|
199
|
+
};
|
|
200
|
+
const bib = {
|
|
201
|
+
name: 'bibtex',
|
|
202
|
+
claims: (file) => file.id.endsWith('.bib'),
|
|
203
|
+
initialize: (store, file) => readBibliography(store, file),
|
|
204
|
+
};
|
|
205
|
+
return {
|
|
206
|
+
name: 'blog',
|
|
207
|
+
contentDir,
|
|
208
|
+
include: (id) => id.endsWith('.svx') || id.endsWith('.bib'),
|
|
209
|
+
doctypes: [post, sequence, statement, bib],
|
|
210
|
+
resolvers: [
|
|
211
|
+
// On the page itself, a citation jumps to the page's own list. A
|
|
212
|
+
// description is shown on the listings, so it points at the list
|
|
213
|
+
// on its post's page.
|
|
214
|
+
citations({
|
|
215
|
+
url: (key, store, doc) => doc.doctype == 'description'
|
|
216
|
+
? `/${store.pathnameOf(doc.id)}/#cite:${key}`
|
|
217
|
+
: `#cite:${key}`,
|
|
218
|
+
}),
|
|
219
|
+
equations(),
|
|
220
|
+
statements(),
|
|
221
|
+
pathnameLinks(),
|
|
222
|
+
],
|
|
223
|
+
headingDepth: 2,
|
|
224
|
+
runtime: '@mvarble/mesearch-cms/presets/blog/runtime',
|
|
225
|
+
snapshot: (store) => ({
|
|
226
|
+
posts: [...store.collection('posts').values()],
|
|
227
|
+
sequences: [...store.collection('sequences').values()],
|
|
228
|
+
pages: Object.fromEntries([...store.pages].map(([pathname, page]) => [pathname, page.doc])),
|
|
229
|
+
headings: Object.fromEntries([...store.docs].map(([id, doc]) => [id, doc.headings])),
|
|
230
|
+
citations: [...store.collection('citations').values()],
|
|
231
|
+
bibliography: bibliographies(store),
|
|
232
|
+
links: pageLinks(store),
|
|
233
|
+
}),
|
|
234
|
+
};
|
|
235
|
+
}
|
|
236
|
+
// Which pages refer to which: by a link, or to an equation or a statement
|
|
237
|
+
// shown on the other page. Once per pair and direction, in the order found.
|
|
238
|
+
function pageLinks(store) {
|
|
239
|
+
const seen = new Set();
|
|
240
|
+
const links = [];
|
|
241
|
+
for (const id of store.docs.keys()) {
|
|
242
|
+
const from = store.pathnameOf(id);
|
|
243
|
+
if (from === undefined)
|
|
244
|
+
continue;
|
|
245
|
+
for (const ref of store.refsOf(id)) {
|
|
246
|
+
const target = ref.target;
|
|
247
|
+
const to = ref.resolver == 'page'
|
|
248
|
+
? target.pathname?.replace(/\/+$/, '')
|
|
249
|
+
: (ref.resolver == 'statement' || ref.resolver == 'equation') &&
|
|
250
|
+
target.scope !== undefined &&
|
|
251
|
+
target.slug !== undefined
|
|
252
|
+
? store.anchor(ref.resolver, target.scope, target.slug)?.page
|
|
253
|
+
: undefined;
|
|
254
|
+
if (to === undefined || to == from || !store.pages.has(to))
|
|
255
|
+
continue;
|
|
256
|
+
const key = `${from}\0${to}`;
|
|
257
|
+
if (seen.has(key))
|
|
258
|
+
continue;
|
|
259
|
+
seen.add(key);
|
|
260
|
+
links.push({ from, to });
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
return links;
|
|
264
|
+
}
|
|
265
|
+
// The page tree a sequence declares, read from each page's own frontmatter.
|
|
266
|
+
// Anything wrong with it drops the whole sequence, reported once.
|
|
267
|
+
function buildChildren(store, rootFilename, children, appendixStart, topLevel) {
|
|
268
|
+
const out = [];
|
|
269
|
+
let appendix = appendixStart;
|
|
270
|
+
for (const child of children) {
|
|
271
|
+
if (typeof child != 'object' || !child) {
|
|
272
|
+
store.error(rootFilename, `${rootFilename}: each entry of \`children\` must be an object.`);
|
|
273
|
+
return;
|
|
274
|
+
}
|
|
275
|
+
// Once one top-level child is marked as an appendix, the rest are too.
|
|
276
|
+
if (topLevel && !appendix && child.appendix === true) {
|
|
277
|
+
appendix = true;
|
|
278
|
+
}
|
|
279
|
+
const entry = new Frontmatter(store.root, rootFilename, child, 'Sequence child');
|
|
280
|
+
const relative = entry.requiredString('filename');
|
|
281
|
+
if (!report(store, entry))
|
|
282
|
+
return;
|
|
283
|
+
const filename = resolveId(rootFilename, relative);
|
|
284
|
+
let file;
|
|
285
|
+
try {
|
|
286
|
+
file = store.file(filename);
|
|
287
|
+
}
|
|
288
|
+
catch {
|
|
289
|
+
store.error(rootFilename, `${rootFilename}: \`${relative}\` does not exist.`);
|
|
290
|
+
return;
|
|
291
|
+
}
|
|
292
|
+
const page = new Frontmatter(store.root, filename, file.frontmatter, 'Sequence page');
|
|
293
|
+
const title = page.requiredString('title');
|
|
294
|
+
const slug = page.slug();
|
|
295
|
+
const katexMacros = page.katexMacros();
|
|
296
|
+
if (!report(store, page))
|
|
297
|
+
return;
|
|
298
|
+
const nested = entry.optionalArray('children');
|
|
299
|
+
if (!nested) {
|
|
300
|
+
out.push({ title, slug, filename, katexMacros, appendix });
|
|
301
|
+
continue;
|
|
302
|
+
}
|
|
303
|
+
// A sequence is chapters and sections, and nothing below that. The table
|
|
304
|
+
// of contents spends its third level on the headings within a page, so a
|
|
305
|
+
// deeper page tree would have nowhere left to go.
|
|
306
|
+
if (!topLevel) {
|
|
307
|
+
store.error(rootFilename, `${rootFilename}: \`${relative}\` nests a third level of pages; ` +
|
|
308
|
+
'a sequence has chapters and sections only.');
|
|
309
|
+
return;
|
|
310
|
+
}
|
|
311
|
+
const grandchildren = buildChildren(store, rootFilename, nested, appendix, false);
|
|
312
|
+
if (!grandchildren)
|
|
313
|
+
return;
|
|
314
|
+
out.push({ title, slug, filename, katexMacros, children: grandchildren, appendix });
|
|
315
|
+
}
|
|
316
|
+
return out;
|
|
317
|
+
}
|
|
318
|
+
function registerScope(store, slug, id, name) {
|
|
319
|
+
if (!store.scopes.has(slug))
|
|
320
|
+
store.scopes.set(slug, id);
|
|
321
|
+
store.scopeNames.set(id, name);
|
|
322
|
+
}
|
|
323
|
+
// A description is shown on the listings rather than on a page of its own. It
|
|
324
|
+
// folds its owner's macros and resolves links as though written on its page.
|
|
325
|
+
function registerDescription(store, id, owner) {
|
|
326
|
+
if (!id)
|
|
327
|
+
return;
|
|
328
|
+
let macros;
|
|
329
|
+
try {
|
|
330
|
+
macros = new Frontmatter(store.root, id, store.file(id).frontmatter, 'Description').katexMacros();
|
|
331
|
+
}
|
|
332
|
+
catch {
|
|
333
|
+
store.error(owner, `${owner}: the description \`${id}\` does not exist.`);
|
|
334
|
+
return;
|
|
335
|
+
}
|
|
336
|
+
store.addDoc(docRecord(id, 'description', { scope: owner, host: owner, macroParent: owner, macros }));
|
|
337
|
+
}
|
|
338
|
+
// Hands a reader's problems to the store, answering whether there were none.
|
|
339
|
+
function report(store, fm) {
|
|
340
|
+
const valid = fm.valid();
|
|
341
|
+
for (const problem of fm.problems)
|
|
342
|
+
store.error(fm.filename, problem);
|
|
343
|
+
fm.problems.length = 0;
|
|
344
|
+
return valid;
|
|
345
|
+
}
|
|
346
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","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CAAC,EAAE,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IACrE,EAAE,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC;IACvB,OAAO,KAAK,CAAC;AACjB,CAAC"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import type { BlogSnapshot, Post, PostInfo, Sequence } from './types.ts';
|
|
2
|
+
export type * from './types.ts';
|
|
3
|
+
export { citationLabel } from '../../resolvers/citation.ts';
|
|
4
|
+
export declare function bind(snapshot: BlogSnapshot): {
|
|
5
|
+
posts: {
|
|
6
|
+
list: ({ limit }?: {
|
|
7
|
+
limit?: number;
|
|
8
|
+
}) => PostInfo[];
|
|
9
|
+
get: (pathname: string) => Post | undefined;
|
|
10
|
+
};
|
|
11
|
+
sequences: {
|
|
12
|
+
list: ({ limit }?: {
|
|
13
|
+
limit?: number;
|
|
14
|
+
}) => PostInfo[];
|
|
15
|
+
get: (slug: string) => Sequence | undefined;
|
|
16
|
+
containing: (filename: string) => Sequence | undefined;
|
|
17
|
+
};
|
|
18
|
+
pages: {
|
|
19
|
+
get: (pathname: string) => {
|
|
20
|
+
pathname: string;
|
|
21
|
+
filename: string;
|
|
22
|
+
} | undefined;
|
|
23
|
+
};
|
|
24
|
+
headings: (filename: string) => import("./types.ts").Heading[];
|
|
25
|
+
outline: (filename: string) => import("./types.ts").OutlineEntry[];
|
|
26
|
+
citations: {
|
|
27
|
+
list: () => import("./types.ts").Citation[];
|
|
28
|
+
};
|
|
29
|
+
bibliography: (pathname: string) => import("./types.ts").Citation[];
|
|
30
|
+
links: () => import("./types.ts").PageLink[];
|
|
31
|
+
};
|
|
32
|
+
export type BlogCms = ReturnType<typeof bind>;
|
|
33
|
+
export declare const bindLive: (current: () => BlogSnapshot) => {
|
|
34
|
+
posts: {
|
|
35
|
+
list: ({ limit }?: {
|
|
36
|
+
limit?: number;
|
|
37
|
+
}) => PostInfo[];
|
|
38
|
+
get: (pathname: string) => Post | undefined;
|
|
39
|
+
};
|
|
40
|
+
sequences: {
|
|
41
|
+
list: ({ limit }?: {
|
|
42
|
+
limit?: number;
|
|
43
|
+
}) => PostInfo[];
|
|
44
|
+
get: (slug: string) => Sequence | undefined;
|
|
45
|
+
containing: (filename: string) => Sequence | undefined;
|
|
46
|
+
};
|
|
47
|
+
pages: {
|
|
48
|
+
get: (pathname: string) => {
|
|
49
|
+
pathname: string;
|
|
50
|
+
filename: string;
|
|
51
|
+
} | undefined;
|
|
52
|
+
};
|
|
53
|
+
headings: (filename: string) => import("./types.ts").Heading[];
|
|
54
|
+
outline: (filename: string) => import("./types.ts").OutlineEntry[];
|
|
55
|
+
citations: {
|
|
56
|
+
list: () => import("./types.ts").Citation[];
|
|
57
|
+
};
|
|
58
|
+
bibliography: (pathname: string) => import("./types.ts").Citation[];
|
|
59
|
+
links: () => import("./types.ts").PageLink[];
|
|
60
|
+
};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
// The queries a blog's `load` functions call, over the snapshot the Vite plugin
|
|
2
|
+
// inlines into the virtual module. Nothing here touches the filesystem: it is
|
|
3
|
+
// bundled into the server build and runs wherever that runs.
|
|
4
|
+
import { buildOutline } from "../../model/outline.js";
|
|
5
|
+
import { live } from "../../runtime.js";
|
|
6
|
+
export { citationLabel } from "../../resolvers/citation.js";
|
|
7
|
+
const info = (post) => ({
|
|
8
|
+
title: post.title,
|
|
9
|
+
created: post.created,
|
|
10
|
+
edited: post.edited,
|
|
11
|
+
pathname: post.pathname,
|
|
12
|
+
descriptionFilename: post.descriptionFilename,
|
|
13
|
+
imageFilename: post.imageFilename,
|
|
14
|
+
tags: post.tags,
|
|
15
|
+
});
|
|
16
|
+
// Most recently edited first. The sort is stable, so ties keep the order the
|
|
17
|
+
// content was scanned in.
|
|
18
|
+
const latest = (items, limit) => items
|
|
19
|
+
.toSorted((a, b) => b.edited.valueOf() - a.edited.valueOf())
|
|
20
|
+
.slice(0, limit ?? items.length);
|
|
21
|
+
const contains = (children, filename) => children.some((child) => child.filename == filename || contains(child.children, filename));
|
|
22
|
+
export function bind(snapshot) {
|
|
23
|
+
return {
|
|
24
|
+
posts: {
|
|
25
|
+
list: ({ limit } = {}) => latest(snapshot.posts, limit).map(info),
|
|
26
|
+
get: (pathname) => snapshot.posts.find((post) => post.pathname == pathname),
|
|
27
|
+
},
|
|
28
|
+
sequences: {
|
|
29
|
+
list: ({ limit } = {}) => latest(snapshot.sequences, limit).map(info),
|
|
30
|
+
get: (slug) => snapshot.sequences.find((sequence) => sequence.slug == slug),
|
|
31
|
+
// The sequence a document belongs to, whether as its root or as
|
|
32
|
+
// one of its pages.
|
|
33
|
+
containing: (filename) => snapshot.sequences.find((sequence) => sequence.filename == filename || contains(sequence.children, filename)),
|
|
34
|
+
},
|
|
35
|
+
pages: {
|
|
36
|
+
get: (pathname) => {
|
|
37
|
+
const filename = snapshot.pages[pathname];
|
|
38
|
+
return filename === undefined ? undefined : { pathname, filename };
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
headings: (filename) => snapshot.headings[filename] ?? [],
|
|
42
|
+
// A page's headings as the tree a table of contents renders.
|
|
43
|
+
outline: (filename) => buildOutline(snapshot.headings[filename] ?? []),
|
|
44
|
+
citations: {
|
|
45
|
+
list: () => snapshot.citations,
|
|
46
|
+
},
|
|
47
|
+
// The references a page cites, for the list at its end.
|
|
48
|
+
bibliography: (pathname) => snapshot.bibliography[pathname] ?? [],
|
|
49
|
+
// Which pages refer to which: by a link, or to an equation or a
|
|
50
|
+
// statement on the other page.
|
|
51
|
+
links: () => snapshot.links,
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
export const bindLive = (current) => live(bind, current);
|
|
55
|
+
//# sourceMappingURL=runtime.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime.js","sourceRoot":"","sources":["../../../src/presets/blog/runtime.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,8EAA8E;AAC9E,6DAA6D;AAC7D,OAAO,EAAE,YAAY,EAA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C9E,SAAS,EAAE;YACP,IAAI,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,SAAS;SACjC;QACD,wDAAwD;QACxD,YAAY,EAAE,CAAC,QAAgB,EAAE,EAAE,CAAC,QAAQ,CAAC,YAAY,CAAC,QAAQ,CAAC,IAAI,EAAE;QACzE,gEAAgE;QAChE,+BAA+B;QAC/B,KAAK,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,KAAK;KAC9B,CAAC;AACN,CAAC;AAID,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,OAA2B,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { KatexMacros } from '@mvarble/mesearch-markdown/katex';
|
|
2
|
+
import type { Heading } from '../../model/outline.ts';
|
|
3
|
+
import type { Citation } from '../../resolvers/citation.ts';
|
|
4
|
+
export interface PostInfo {
|
|
5
|
+
title: string;
|
|
6
|
+
created: Date;
|
|
7
|
+
edited: Date;
|
|
8
|
+
pathname: string;
|
|
9
|
+
descriptionFilename?: string;
|
|
10
|
+
imageFilename?: string;
|
|
11
|
+
tags: string[];
|
|
12
|
+
}
|
|
13
|
+
export interface Post extends PostInfo {
|
|
14
|
+
slug: string;
|
|
15
|
+
filename: string;
|
|
16
|
+
katexMacros: KatexMacros;
|
|
17
|
+
}
|
|
18
|
+
export interface SequenceChild {
|
|
19
|
+
title: string;
|
|
20
|
+
slug: string;
|
|
21
|
+
pathname: string;
|
|
22
|
+
filename: string;
|
|
23
|
+
katexMacros: KatexMacros;
|
|
24
|
+
label?: string;
|
|
25
|
+
appendix: boolean;
|
|
26
|
+
children: SequenceChild[];
|
|
27
|
+
}
|
|
28
|
+
export interface Sequence extends Post {
|
|
29
|
+
enumerate: boolean;
|
|
30
|
+
label?: string;
|
|
31
|
+
children: SequenceChild[];
|
|
32
|
+
}
|
|
33
|
+
export interface BlogSnapshot {
|
|
34
|
+
posts: Post[];
|
|
35
|
+
sequences: Sequence[];
|
|
36
|
+
pages: Record<string, string>;
|
|
37
|
+
headings: Record<string, Heading[]>;
|
|
38
|
+
citations: Citation[];
|
|
39
|
+
bibliography: Record<string, Citation[]>;
|
|
40
|
+
links: PageLink[];
|
|
41
|
+
}
|
|
42
|
+
export interface PageLink {
|
|
43
|
+
from: string;
|
|
44
|
+
to: string;
|
|
45
|
+
}
|
|
46
|
+
export type { Citation, CitationAuthor } from '../../resolvers/citation.ts';
|
|
47
|
+
export type { StatementInjection } from '../../core/statements.ts';
|
|
48
|
+
export type { Heading, OutlineEntry } from '../../model/outline.ts';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/presets/blog/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { execFileSync } from 'node:child_process';
|
|
2
|
+
import fs from 'node:fs';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
import { toAbsolute } from "../../core/paths.js";
|
|
5
|
+
// Dates from the git history of everything under `dir`, falling back to file
|
|
6
|
+
// modification times for whatever git knows nothing about.
|
|
7
|
+
//
|
|
8
|
+
// One `git log` call covers the whole directory. A folder's dates are the
|
|
9
|
+
// earliest and latest commits that touched any file in it --- assets and
|
|
10
|
+
// components included, since editing a figure is editing the document. A folder
|
|
11
|
+
// with uncommitted changes counts as updated now-ish, by its newest mtime. A
|
|
12
|
+
// checkout resets every mtime, so mtimes are only ever a last resort.
|
|
13
|
+
export function gitDates(root, dir) {
|
|
14
|
+
const spans = new Map();
|
|
15
|
+
const dirty = new Set();
|
|
16
|
+
try {
|
|
17
|
+
const run = (...args) => execFileSync('git', args, {
|
|
18
|
+
cwd: root,
|
|
19
|
+
encoding: 'utf8',
|
|
20
|
+
stdio: ['ignore', 'pipe', 'ignore'],
|
|
21
|
+
maxBuffer: 64 * 1024 * 1024,
|
|
22
|
+
});
|
|
23
|
+
// Paths in git's output are relative to the repository's top level,
|
|
24
|
+
// which need not be the project root.
|
|
25
|
+
const prefix = run('rev-parse', '--show-prefix').trim();
|
|
26
|
+
const strip = (file) => file.startsWith(prefix) ? file.slice(prefix.length) : undefined;
|
|
27
|
+
let when;
|
|
28
|
+
for (const line of run('log', '--format=%x00%cI', '--name-only', '--no-renames', '--', dir).split('\n')) {
|
|
29
|
+
if (line.startsWith('\0')) {
|
|
30
|
+
when = new Date(line.slice(1));
|
|
31
|
+
}
|
|
32
|
+
else if (line && when) {
|
|
33
|
+
const file = strip(line);
|
|
34
|
+
if (!file)
|
|
35
|
+
continue;
|
|
36
|
+
// Newest commits come first, so the first sighting is the last
|
|
37
|
+
// change and every later one pushes the first change back.
|
|
38
|
+
const span = spans.get(file);
|
|
39
|
+
if (span)
|
|
40
|
+
span.first = when;
|
|
41
|
+
else
|
|
42
|
+
spans.set(file, { first: when, last: when });
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
for (const line of run('status', '--porcelain', '--', dir).split('\n')) {
|
|
46
|
+
const file = strip(line.slice(3).trim());
|
|
47
|
+
if (file)
|
|
48
|
+
dirty.add(file);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
catch {
|
|
52
|
+
// Not a repository, or no git: every date comes from the filesystem.
|
|
53
|
+
}
|
|
54
|
+
return (folder) => {
|
|
55
|
+
const within = (file) => file == folder || file.startsWith(folder + '/');
|
|
56
|
+
let first;
|
|
57
|
+
let last;
|
|
58
|
+
for (const [file, span] of spans) {
|
|
59
|
+
if (!within(file))
|
|
60
|
+
continue;
|
|
61
|
+
if (!first || span.first < first)
|
|
62
|
+
first = span.first;
|
|
63
|
+
if (!last || span.last > last)
|
|
64
|
+
last = span.last;
|
|
65
|
+
}
|
|
66
|
+
const mtimes = folderTimes(root, folder);
|
|
67
|
+
if ([...dirty].some(within) && mtimes)
|
|
68
|
+
last = mtimes.updated;
|
|
69
|
+
if (!first || !last)
|
|
70
|
+
return mtimes;
|
|
71
|
+
return { created: first, updated: last > first ? last : first };
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
// The oldest birth time and newest modification time of anything in a folder.
|
|
75
|
+
function folderTimes(root, folder) {
|
|
76
|
+
const abs = toAbsolute(root, folder);
|
|
77
|
+
let created;
|
|
78
|
+
let updated;
|
|
79
|
+
const visit = (file) => {
|
|
80
|
+
const stat = fs.statSync(file);
|
|
81
|
+
if (stat.isDirectory()) {
|
|
82
|
+
for (const entry of fs.readdirSync(file))
|
|
83
|
+
visit(path.join(file, entry));
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
const born = stat.birthtimeMs > 0 ? stat.birthtime : stat.mtime;
|
|
87
|
+
if (!created || born < created)
|
|
88
|
+
created = born;
|
|
89
|
+
if (!updated || stat.mtime > updated)
|
|
90
|
+
updated = stat.mtime;
|
|
91
|
+
};
|
|
92
|
+
try {
|
|
93
|
+
visit(abs);
|
|
94
|
+
}
|
|
95
|
+
catch {
|
|
96
|
+
return undefined;
|
|
97
|
+
}
|
|
98
|
+
return created && updated ? { created, updated } : undefined;
|
|
99
|
+
}
|
|
100
|
+
//# sourceMappingURL=dates.js.map
|