@wizzlethorpe/vaults 0.6.1 → 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/README.md +135 -17
- package/dist/build.js +433 -181
- package/dist/build.js.map +1 -1
- package/dist/commands/build.js +4 -4
- package/dist/commands/build.js.map +1 -1
- package/dist/commands/init.js +13 -10
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/password.js +3 -1
- package/dist/commands/password.js.map +1 -1
- package/dist/commands/patreon.js +30 -20
- package/dist/commands/patreon.js.map +1 -1
- package/dist/commands/preview.js +10 -8
- package/dist/commands/preview.js.map +1 -1
- package/dist/commands/push.js +11 -9
- package/dist/commands/push.js.map +1 -1
- package/dist/commands/role.js +5 -0
- package/dist/commands/role.js.map +1 -1
- package/dist/config.js +30 -15
- package/dist/config.js.map +1 -1
- package/dist/escape.js +29 -0
- package/dist/escape.js.map +1 -0
- package/dist/favicon.js +3 -36
- package/dist/favicon.js.map +1 -1
- package/dist/foundry-importer.js +61 -0
- package/dist/foundry-importer.js.map +1 -0
- package/dist/images.js +0 -30
- package/dist/images.js.map +1 -1
- package/dist/index.js +37 -4
- package/dist/index.js.map +1 -1
- package/dist/migrate/0.6-legacy-auth-settings.js +96 -0
- package/dist/migrate/0.6-legacy-auth-settings.js.map +1 -0
- package/dist/migrate/0.7-vaults-dir.js +70 -0
- package/dist/migrate/0.7-vaults-dir.js.map +1 -0
- package/dist/migrate/registry.js +6 -0
- package/dist/migrate/registry.js.map +1 -0
- package/dist/migrate/run.js +38 -0
- package/dist/migrate/run.js.map +1 -0
- package/dist/migrate/types.js +8 -0
- package/dist/migrate/types.js.map +1 -0
- package/dist/paths.js +66 -0
- package/dist/paths.js.map +1 -0
- package/dist/render/auth-template.js +23 -141
- package/dist/render/auth-template.js.map +1 -1
- package/dist/render/bases.js +56 -44
- package/dist/render/bases.js.map +1 -1
- package/dist/render/callouts.js +29 -10
- package/dist/render/callouts.js.map +1 -1
- package/dist/render/embed.js +124 -26
- package/dist/render/embed.js.map +1 -1
- package/dist/render/extensions.js +68 -0
- package/dist/render/extensions.js.map +1 -0
- package/dist/render/external-links.js +32 -0
- package/dist/render/external-links.js.map +1 -0
- package/dist/render/footer.js +37 -0
- package/dist/render/footer.js.map +1 -0
- package/dist/render/frontmatter.js +17 -0
- package/dist/render/frontmatter.js.map +1 -0
- package/dist/render/handlers/assets.js +123 -0
- package/dist/render/handlers/assets.js.map +1 -0
- package/dist/render/handlers/builtin/dice.js +78 -0
- package/dist/render/handlers/builtin/dice.js.map +1 -0
- package/dist/render/handlers/builtin/fm-code.js +50 -0
- package/dist/render/handlers/builtin/fm-code.js.map +1 -0
- package/dist/render/handlers/builtin/fm.js +83 -0
- package/dist/render/handlers/builtin/fm.js.map +1 -0
- package/dist/render/handlers/builtin/index.js +10 -0
- package/dist/render/handlers/builtin/index.js.map +1 -0
- package/dist/render/handlers/builtin/inline-format.js +26 -0
- package/dist/render/handlers/builtin/inline-format.js.map +1 -0
- package/dist/render/handlers/builtin/statblock.js +491 -0
- package/dist/render/handlers/builtin/statblock.js.map +1 -0
- package/dist/render/handlers/dispatch.js +182 -0
- package/dist/render/handlers/dispatch.js.map +1 -0
- package/dist/render/handlers/loader.js +90 -0
- package/dist/render/handlers/loader.js.map +1 -0
- package/dist/render/handlers/types.js +60 -0
- package/dist/render/handlers/types.js.map +1 -0
- package/dist/render/image-srcs.js +42 -0
- package/dist/render/image-srcs.js.map +1 -0
- package/dist/render/layout.js +62 -9
- package/dist/render/layout.js.map +1 -1
- package/dist/render/pipeline.js +37 -8
- package/dist/render/pipeline.js.map +1 -1
- package/dist/render/preview.js +10 -5
- package/dist/render/preview.js.map +1 -1
- package/dist/render/slug.js +5 -0
- package/dist/render/slug.js.map +1 -1
- package/dist/render/styles.js +118 -11
- package/dist/render/styles.js.map +1 -1
- package/dist/render/wikilink.js +15 -4
- package/dist/render/wikilink.js.map +1 -1
- package/dist/scan.js +1 -1
- package/dist/scan.js.map +1 -1
- package/dist/settings.js +25 -4
- package/dist/settings.js.map +1 -1
- package/dist/version.js +36 -0
- package/dist/version.js.map +1 -0
- package/package.json +12 -12
- package/dist/api.js +0 -42
- package/dist/api.js.map +0 -1
- package/dist/render/mcp-template.js +0 -239
- package/dist/render/mcp-template.js.map +0 -1
package/dist/render/pipeline.js
CHANGED
|
@@ -9,15 +9,20 @@ import rehypeStringify from "rehype-stringify";
|
|
|
9
9
|
import matter from "gray-matter";
|
|
10
10
|
import { wikiLinkPlugin } from "./wikilink.js";
|
|
11
11
|
import { embedPlugin } from "./embed.js";
|
|
12
|
+
import { externalLinksPlugin } from "./external-links.js";
|
|
13
|
+
import { imageSrcsPlugin } from "./image-srcs.js";
|
|
12
14
|
import { calloutPlugin } from "./callouts.js";
|
|
13
15
|
import { basesPlugin } from "./bases.js";
|
|
16
|
+
import { handlersPlugin } from "./handlers/dispatch.js";
|
|
17
|
+
import { htmlEscape } from "../escape.js";
|
|
18
|
+
import { extractH1 } from "./frontmatter.js";
|
|
14
19
|
const sanitizeSchema = {
|
|
15
20
|
...defaultSchema,
|
|
16
21
|
clobberPrefix: "",
|
|
17
22
|
// Bases emit interactive HTML beyond what the default schema allows:
|
|
18
23
|
// <input> (filter), <button> (tab buttons + dialog actions). Add them
|
|
19
24
|
// and the attributes they need to function.
|
|
20
|
-
tagNames: [...(defaultSchema.tagNames ?? []), "input", "button"],
|
|
25
|
+
tagNames: [...(defaultSchema.tagNames ?? []), "input", "button", "audio", "video", "source"],
|
|
21
26
|
attributes: {
|
|
22
27
|
...defaultSchema.attributes,
|
|
23
28
|
// role + aria-selected/haspopup/label ride on tabs, dialogs, etc.
|
|
@@ -26,23 +31,33 @@ const sanitizeSchema = {
|
|
|
26
31
|
// initial render shows everything because the sanitizer strips it.
|
|
27
32
|
"*": [...(defaultSchema.attributes?.["*"] ?? []), "className", "role", "ariaSelected", "ariaLabel", "ariaHaspopup", "tabindex", "hidden"],
|
|
28
33
|
img: ["src", "alt", "width", "height", "loading"],
|
|
29
|
-
|
|
34
|
+
audio: ["src", "controls", "preload", "loop", "muted"],
|
|
35
|
+
video: ["src", "controls", "preload", "loop", "muted", "width", "height", "poster"],
|
|
36
|
+
source: ["src", "type"],
|
|
37
|
+
a: ["href", "title", "className", "id", "target", "rel"],
|
|
30
38
|
div: ["className", "data*", "role"],
|
|
31
39
|
span: ["className", "data*"],
|
|
40
|
+
code: ["className", "title"],
|
|
32
41
|
table: ["className"],
|
|
33
42
|
th: ["className", "data*", "tabindex"],
|
|
34
43
|
td: ["className", "data*"],
|
|
35
44
|
tr: ["className", "data*"],
|
|
36
45
|
input: ["type", "placeholder", "className", "ariaLabel"],
|
|
37
46
|
button: ["type", "className", "data*", "role", "ariaSelected", "ariaLabel", "ariaHaspopup", "tabindex", "title"],
|
|
47
|
+
// Foldable callouts emit <details open>; the default schema allows
|
|
48
|
+
// `open` on <summary> only.
|
|
49
|
+
details: ["className", "data*", "open"],
|
|
38
50
|
},
|
|
39
51
|
// The default schema forces <input> to type=checkbox and disabled=true
|
|
40
52
|
// to safely render GFM task lists. We don't render task lists here, and
|
|
41
53
|
// the Bases filter input needs to be a writable search box, so reset.
|
|
42
54
|
required: { ...(defaultSchema.required ?? {}), input: {} },
|
|
43
55
|
};
|
|
44
|
-
export async function renderMarkdown(source, context, fallbackTitle) {
|
|
45
|
-
const parsed =
|
|
56
|
+
export async function renderMarkdown(source, context, fallbackTitle, preParsed) {
|
|
57
|
+
const parsed = preParsed ?? (() => {
|
|
58
|
+
const m = matter(source);
|
|
59
|
+
return { data: (m.data ?? {}), content: m.content };
|
|
60
|
+
})();
|
|
46
61
|
const fm = parsed.data;
|
|
47
62
|
const outlinks = [];
|
|
48
63
|
const warnings = [];
|
|
@@ -58,12 +73,30 @@ export async function renderMarkdown(source, context, fallbackTitle) {
|
|
|
58
73
|
const file = await unified()
|
|
59
74
|
.use(remarkParse)
|
|
60
75
|
.use(remarkGfm)
|
|
76
|
+
// Handlers run early so any markdown they emit is processed by the
|
|
77
|
+
// rest of the pipeline (wikilinks resolve, embeds inline, etc.).
|
|
78
|
+
// Empty registry (no built-ins, no user handlers) short-circuits to
|
|
79
|
+
// a no-op walk.
|
|
80
|
+
.use(handlersPlugin({
|
|
81
|
+
registry: context.handlers ?? { inline: new Map(), codeBlock: new Map() },
|
|
82
|
+
context: {
|
|
83
|
+
pagePath: fallbackTitle,
|
|
84
|
+
frontmatter: fm,
|
|
85
|
+
render: context,
|
|
86
|
+
escape: htmlEscape,
|
|
87
|
+
},
|
|
88
|
+
}))
|
|
61
89
|
.use(calloutPlugin({ redactRoles: context.redactRoles }))
|
|
62
90
|
// Bases runs before wikilink/embed: it consumes ```base code fences
|
|
63
91
|
// wholesale and emits raw HTML, so downstream plugins won't try to
|
|
64
92
|
// process anything inside the table.
|
|
65
93
|
.use(basesPlugin({ context, warnings }))
|
|
66
94
|
.use(embedPlugin({ context, warnings }))
|
|
95
|
+
// Normalise plain markdown image URLs (``) to the
|
|
96
|
+
// absolute slugified URL the build emits. Sits after embedPlugin (which
|
|
97
|
+
// handles the wikilink form) so both shapes converge on the same output.
|
|
98
|
+
.use(imageSrcsPlugin({ context }))
|
|
99
|
+
.use(externalLinksPlugin())
|
|
67
100
|
.use(wikiLinkPlugin({ context, outlinks, warnings }))
|
|
68
101
|
.use(remarkRehype, { allowDangerousHtml: true })
|
|
69
102
|
.use(rehypeRaw)
|
|
@@ -76,8 +109,4 @@ export async function renderMarkdown(source, context, fallbackTitle) {
|
|
|
76
109
|
|| fallbackTitle;
|
|
77
110
|
return { html: String(file), title, frontmatter: fm, outlinks, warnings };
|
|
78
111
|
}
|
|
79
|
-
function extractH1(markdown) {
|
|
80
|
-
const m = /^#\s+(.+)$/m.exec(markdown);
|
|
81
|
-
return m ? m[1].trim() : null;
|
|
82
|
-
}
|
|
83
112
|
//# sourceMappingURL=pipeline.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pipeline.js","sourceRoot":"","sources":["../../src/render/pipeline.ts"],"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,cAAc,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC,CAAC;SACpD,GAAG,CAAC,YAAY,EAAE,EAAE,kBAAkB,EAAE,IAAI,EAAE,CAAC;SAC/C,GAAG,CAAC,SAAS,CAAC;SACd,GAAG,CAAC,UAAU,CAAC;SACf,GAAG,CAAC,cAAc,EAAE,cAAc,CAAC;SACnC,GAAG,CAAC,eAAe,CAAC;SACpB,OAAO,CAAC,OAAO,CAAC,CAAC;IAEpB,MAAM,KAAK,GAAG,CAAC,OAAO,EAAE,CAAC,KAAK,KAAK,QAAQ,IAAI,EAAE,CAAC,KAAK,CAAC;WACnD,SAAS,CAAC,MAAM,CAAC,OAAO,CAAC;WACzB,aAAa,CAAC;IAEnB,OAAO,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,WAAW,EAAE,EAAE,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC;AAC5E,CAAC"}
|
package/dist/render/preview.js
CHANGED
|
@@ -5,6 +5,7 @@ import remarkRehype from "remark-rehype";
|
|
|
5
5
|
import rehypeSanitize, { defaultSchema } from "rehype-sanitize";
|
|
6
6
|
import rehypeStringify from "rehype-stringify";
|
|
7
7
|
import { slugify } from "./slug.js";
|
|
8
|
+
import { stripFrontmatter } from "./frontmatter.js";
|
|
8
9
|
const SUMMARY_CHARS = 320;
|
|
9
10
|
const previewPipeline = unified()
|
|
10
11
|
.use(remarkParse)
|
|
@@ -17,8 +18,15 @@ const previewPipeline = unified()
|
|
|
17
18
|
})
|
|
18
19
|
.use(rehypeStringify);
|
|
19
20
|
export async function buildPreview(rawMarkdown, title) {
|
|
20
|
-
// Strip frontmatter
|
|
21
|
-
|
|
21
|
+
// Strip frontmatter, Obsidian %% comments %%, and fenced code blocks
|
|
22
|
+
// before walking the body. Code fences render as a wall of source text
|
|
23
|
+
// in a tiny hover popover, which looks worse than just omitting them —
|
|
24
|
+
// same rationale as the table skip in truncateMarkdown.
|
|
25
|
+
const body = stripFrontmatter(rawMarkdown)
|
|
26
|
+
.replace(/%%[\s\S]*?%%/g, "")
|
|
27
|
+
.replace(/^```[\s\S]*?^```[^\n]*$/gm, "")
|
|
28
|
+
.replace(/^~~~[\s\S]*?^~~~[^\n]*$/gm, "")
|
|
29
|
+
.trim();
|
|
22
30
|
const summary = await renderSnippet(body);
|
|
23
31
|
const headings = {};
|
|
24
32
|
// Match headings even when nested inside a callout/blockquote.
|
|
@@ -75,7 +83,4 @@ function truncateMarkdown(source, maxChars) {
|
|
|
75
83
|
}
|
|
76
84
|
return out.join("\n\n");
|
|
77
85
|
}
|
|
78
|
-
function stripFrontmatter(s) {
|
|
79
|
-
return s.replace(/^---\r?\n[\s\S]*?\r?\n---\r?\n?/, "");
|
|
80
|
-
}
|
|
81
86
|
//# sourceMappingURL=preview.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"preview.js","sourceRoot":"","sources":["../../src/render/preview.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,WAAW,MAAM,cAAc,CAAC;AACvC,OAAO,SAAS,MAAM,YAAY,CAAC;AACnC,OAAO,YAAY,MAAM,eAAe,CAAC;AACzC,OAAO,cAAc,EAAE,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChE,OAAO,eAAe,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"preview.js","sourceRoot":"","sources":["../../src/render/preview.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,WAAW,MAAM,cAAc,CAAC;AACvC,OAAO,SAAS,MAAM,YAAY,CAAC;AACnC,OAAO,YAAY,MAAM,eAAe,CAAC;AACzC,OAAO,cAAc,EAAE,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChE,O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AC,CAAC;IAC3C,MAAM,GAAG,GAAa,EAAE,CAAC;IACzB,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,KAAK,MAAM,GAAG,IAAI,UAAU,EAAE,CAAC;QAC7B,IAAI,CAAC,GAAG,GAAG,CAAC,IAAI,EAAE;aACf,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,CAAuB,2BAA2B;aACxE,OAAO,CAAC,yBAAyB,EAAE,EAAE,CAAC,CAAQ,uCAAuC;aACrF,KAAK,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAE,qBAAqB;aACvF,IAAI,EAAE,CAAC;QACV,IAAI,CAAC,CAAC;YAAE,SAAS;QACjB,IAAI,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;YAAE,SAAS,CAAkB,oBAAoB;QACrE,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;YAAE,SAAS,CAAqB,cAAc;QAC/D,8EAA8E;QAC9E,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,oEAAoE,EAChF,CAAC,CAAC,EAAE,IAAY,EAAE,KAAc,EAAE,EAAE,CAAC,KAAK,IAAI,IAAI,CAAC,CAAC;QACtD,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QACZ,KAAK,IAAI,CAAC,CAAC,MAAM,CAAC;QAClB,IAAI,KAAK,IAAI,QAAQ;YAAE,MAAM;IAC/B,CAAC;IACD,OAAO,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AAC1B,CAAC"}
|
package/dist/render/slug.js
CHANGED
|
@@ -9,4 +9,9 @@ export function slugify(name) {
|
|
|
9
9
|
.replace(/[^a-z0-9]+/g, "-")
|
|
10
10
|
.replace(/^-+|-+$/g, "");
|
|
11
11
|
}
|
|
12
|
+
// Historical alias retained for the bases plugin. The "sibling-import
|
|
13
|
+
// avoidance" comment in bases.ts predates the current shape of slug.ts (which
|
|
14
|
+
// has no imports of its own), so a direct re-export is fine — the alias is
|
|
15
|
+
// kept so existing call sites don't churn.
|
|
16
|
+
export { slugify as slugifySimple };
|
|
12
17
|
//# sourceMappingURL=slug.js.map
|
package/dist/render/slug.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slug.js","sourceRoot":"","sources":["../../src/render/slug.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,gFAAgF;AAChF,MAAM,UAAU,OAAO,CAAC,IAAY;IAClC,OAAO,IAAI;SACR,SAAS,CAAC,MAAM,CAAC;SACjB,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC;SACrB,WAAW,EAAE;SACb,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC;SACrB,OAAO,CAAC,aAAa,EAAE,GAAG,CAAC;SAC3B,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;AAC7B,CAAC"}
|
|
1
|
+
{"version":3,"file":"slug.js","sourceRoot":"","sources":["../../src/render/slug.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,gFAAgF;AAChF,MAAM,UAAU,OAAO,CAAC,IAAY;IAClC,OAAO,IAAI;SACR,SAAS,CAAC,MAAM,CAAC;SACjB,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC;SACrB,WAAW,EAAE;SACb,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC;SACrB,OAAO,CAAC,aAAa,EAAE,GAAG,CAAC;SAC3B,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;AAC7B,CAAC;AAED,sEAAsE;AACtE,8EAA8E;AAC9E,2EAA2E;AAC3E,2CAA2C;AAC3C,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,CAAC"}
|
package/dist/render/styles.js
CHANGED
|
@@ -1,25 +1,42 @@
|
|
|
1
1
|
// Theme + layout styles for the rendered wiki. Self-contained, no build step.
|
|
2
2
|
// Single light theme: parchment + scarlet.
|
|
3
3
|
/**
|
|
4
|
-
* Per-vault theme overrides. When `accent_color
|
|
5
|
-
* settings.md, append this
|
|
6
|
-
* shades (--accent-soft,
|
|
7
|
-
*
|
|
4
|
+
* Per-vault theme overrides. When any of `accent_color`, `bg_color`,
|
|
5
|
+
* `accent_color_dark`, `bg_color_dark` are set in settings.md, append this
|
|
6
|
+
* block after DEFAULT_CSS so it wins. The derived shades (--accent-soft,
|
|
7
|
+
* --wikilink-bg, --rule, etc) are recomputed via color-mix so they stay
|
|
8
|
+
* coherent with whatever colors the user picked.
|
|
9
|
+
*
|
|
10
|
+
* Dark overrides target both the explicit `[data-theme="dark"]` selector
|
|
11
|
+
* and the auto/prefers-dark form, so a vault setting `bg_color_dark`
|
|
12
|
+
* applies whether the visitor forced dark or arrived via OS preference.
|
|
8
13
|
*/
|
|
9
14
|
export function renderThemeOverride(opts) {
|
|
10
15
|
const blocks = [];
|
|
11
16
|
if (opts.lightAccent)
|
|
12
17
|
blocks.push(accentBlock(":root", opts.lightAccent));
|
|
13
18
|
if (opts.lightBg)
|
|
14
|
-
blocks.push(bgBlock(":root", opts.lightBg));
|
|
19
|
+
blocks.push(bgBlock(":root", opts.lightBg, "light"));
|
|
20
|
+
if (opts.darkAccent) {
|
|
21
|
+
blocks.push(accentBlock(`:root[data-theme="dark"]`, opts.darkAccent));
|
|
22
|
+
blocks.push(`@media (prefers-color-scheme: dark) {\n${accentBlock(` :root[data-theme="auto"]`, opts.darkAccent)}\n}`);
|
|
23
|
+
}
|
|
24
|
+
if (opts.darkBg) {
|
|
25
|
+
blocks.push(bgBlock(`:root[data-theme="dark"]`, opts.darkBg, "dark"));
|
|
26
|
+
blocks.push(`@media (prefers-color-scheme: dark) {\n${bgBlock(` :root[data-theme="auto"]`, opts.darkBg, "dark")}\n}`);
|
|
27
|
+
}
|
|
15
28
|
if (!blocks.length)
|
|
16
29
|
return "";
|
|
17
30
|
return "\n\n/* User theme overrides (settings.md) */\n" + blocks.join("\n");
|
|
18
31
|
}
|
|
19
|
-
|
|
32
|
+
/** `--rule` is a slightly off-bg shade for hairlines + borders. In light
|
|
33
|
+
* mode that means "darker than bg"; in dark mode the relationship inverts
|
|
34
|
+
* to "lighter than bg" or the rule disappears against the background. */
|
|
35
|
+
function bgBlock(selector, color, mode) {
|
|
36
|
+
const tint = mode === "light" ? "#000" : "#fff";
|
|
20
37
|
return `${selector} {
|
|
21
38
|
--bg: ${color};
|
|
22
|
-
--rule: color-mix(in srgb, ${color} 85%,
|
|
39
|
+
--rule: color-mix(in srgb, ${color} 85%, ${tint});
|
|
23
40
|
}`;
|
|
24
41
|
}
|
|
25
42
|
function accentBlock(selector, color) {
|
|
@@ -38,6 +55,26 @@ export const DEFAULT_CSS = `:root {
|
|
|
38
55
|
--max-width: 56rem;
|
|
39
56
|
font-family: 'Iowan Old Style', 'Palatino Linotype', Georgia, serif;
|
|
40
57
|
}
|
|
58
|
+
/* Dark palette: deep warm bg, brighter scarlet for readable contrast.
|
|
59
|
+
Activates when settings.theme = "dark", or when the visitor's OS prefers
|
|
60
|
+
dark and settings.theme = "auto". The light defaults above are the base;
|
|
61
|
+
these vars override only when [data-theme=...] matches. */
|
|
62
|
+
:root[data-theme="dark"],
|
|
63
|
+
:root[data-theme="dark"] body {
|
|
64
|
+
--bg: #1d1a17; --fg: #e8dec8; --muted: #9a8e78;
|
|
65
|
+
--accent: #d35550; --accent-soft: #e87a75; --accent-fg: #1d1a17;
|
|
66
|
+
--rule: #3a342d;
|
|
67
|
+
--wikilink-bg: rgba(211,85,80,0.16); --wikilink-bg-hover: rgba(211,85,80,0.28);
|
|
68
|
+
}
|
|
69
|
+
@media (prefers-color-scheme: dark) {
|
|
70
|
+
:root[data-theme="auto"],
|
|
71
|
+
:root[data-theme="auto"] body {
|
|
72
|
+
--bg: #1d1a17; --fg: #e8dec8; --muted: #9a8e78;
|
|
73
|
+
--accent: #d35550; --accent-soft: #e87a75; --accent-fg: #1d1a17;
|
|
74
|
+
--rule: #3a342d;
|
|
75
|
+
--wikilink-bg: rgba(211,85,80,0.16); --wikilink-bg-hover: rgba(211,85,80,0.28);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
41
78
|
* { box-sizing: border-box; }
|
|
42
79
|
body { margin: 0; background: var(--bg); color: var(--fg); line-height: 1.6; }
|
|
43
80
|
a { color: var(--accent); text-decoration: none; }
|
|
@@ -63,8 +100,18 @@ article a.internal.new, article a.internal.is-unresolved { opacity: 0.7; font-st
|
|
|
63
100
|
.app-grid {
|
|
64
101
|
display: grid; grid-template-columns: 15rem minmax(0, 56rem) 17rem;
|
|
65
102
|
gap: 2.5rem; max-width: 96rem; margin: 0 auto; padding: 1.5rem;
|
|
66
|
-
|
|
67
|
-
|
|
103
|
+
/* Sticky-footer plumbing: the grid fills the viewport so the main
|
|
104
|
+
column can stretch even when the article is short, and the flex
|
|
105
|
+
column inside main (below) pushes the footer to its bottom. */
|
|
106
|
+
min-height: 100vh; box-sizing: border-box;
|
|
107
|
+
}
|
|
108
|
+
main {
|
|
109
|
+
display: flex; flex-direction: column;
|
|
110
|
+
padding: 2rem 0 0; min-width: 0;
|
|
111
|
+
}
|
|
112
|
+
/* Article grows to absorb spare space; the footer falls naturally to
|
|
113
|
+
the bottom of main whatever the article's intrinsic height. */
|
|
114
|
+
main > article { flex: 1 0 auto; }
|
|
68
115
|
.sidebar { padding: 1.5rem 1.5rem 1.5rem 0; border-right: 1px solid var(--rule); font-size: 0.9rem; display: flex; flex-direction: column; gap: 0.6rem; }
|
|
69
116
|
/* Visual break between the header group (brand/search/auth) and the sitemap. */
|
|
70
117
|
.sidebar > nav:last-child { margin-top: 0.9rem; padding-top: 0.9rem; border-top: 1px solid var(--rule); }
|
|
@@ -78,7 +125,7 @@ main { padding: 2rem 0 4rem; min-width: 0; }
|
|
|
78
125
|
.app-grid { grid-template-columns: 1fr; gap: 0; padding: 0.75rem; max-width: 100%; }
|
|
79
126
|
.sidebar { border: none; padding: 0.5rem 0 0; }
|
|
80
127
|
.rightbar { display: none; }
|
|
81
|
-
main { padding: 0.5rem 0
|
|
128
|
+
main { padding: 0.5rem 0 0; }
|
|
82
129
|
article h1 { font-size: 2rem; }
|
|
83
130
|
article h2 { font-size: 1.4rem; }
|
|
84
131
|
}
|
|
@@ -121,6 +168,37 @@ main { padding: 2rem 0 4rem; min-width: 0; }
|
|
|
121
168
|
.search-result-folder { font-size: 0.72rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; margin-top: 0.15rem; }
|
|
122
169
|
.search-empty { padding: 0.75rem; color: var(--muted); font-style: italic; font-size: 0.85rem; }
|
|
123
170
|
|
|
171
|
+
/* Sidebar row that holds the theme toggle (always present) and, on
|
|
172
|
+
multi-role builds, the auth box. Lays them out left-to-right with the
|
|
173
|
+
auth box absorbing remaining width so its existing button styling stays
|
|
174
|
+
correct regardless of theme-toggle width. */
|
|
175
|
+
.sidebar-row {
|
|
176
|
+
display: flex; align-items: center; gap: 0.5rem;
|
|
177
|
+
}
|
|
178
|
+
.sidebar-row > .auth-box { flex: 1; min-width: 0; }
|
|
179
|
+
|
|
180
|
+
/* Theme toggle: small square icon button matching the auth-box height so
|
|
181
|
+
they line up. Sun icon when current theme is dark (click → switch to
|
|
182
|
+
light); moon icon when current is light. The script paints the icon. */
|
|
183
|
+
.theme-toggle {
|
|
184
|
+
flex: 0 0 auto;
|
|
185
|
+
display: inline-flex; align-items: center; justify-content: center;
|
|
186
|
+
width: 2rem; height: 2rem;
|
|
187
|
+
padding: 0; margin: 0;
|
|
188
|
+
background: transparent;
|
|
189
|
+
color: var(--accent);
|
|
190
|
+
border: 1px solid var(--rule);
|
|
191
|
+
border-radius: 4px;
|
|
192
|
+
cursor: pointer;
|
|
193
|
+
transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
|
|
194
|
+
}
|
|
195
|
+
.theme-toggle:hover {
|
|
196
|
+
background: var(--wikilink-bg);
|
|
197
|
+
border-color: var(--accent-soft);
|
|
198
|
+
}
|
|
199
|
+
.theme-toggle .theme-toggle-icon { display: inline-flex; }
|
|
200
|
+
.theme-toggle .theme-toggle-icon svg { display: block; }
|
|
201
|
+
|
|
124
202
|
/* Auth box; sits under the search box; populated by JS from a non-HttpOnly
|
|
125
203
|
display cookie set by the Function on login. */
|
|
126
204
|
.auth-box {
|
|
@@ -279,6 +357,20 @@ main { padding: 2rem 0 4rem; min-width: 0; }
|
|
|
279
357
|
.page-meta time { font-variant-numeric: tabular-nums; }
|
|
280
358
|
.page-meta .meta-sep { opacity: 0.5; }
|
|
281
359
|
|
|
360
|
+
/* Site-wide footer rendered from the footer setting (markdown). Sits
|
|
361
|
+
below the article, outside <article>, so it's clearly chrome and
|
|
362
|
+
doesn't get caught by article-scoped selectors. */
|
|
363
|
+
.site-footer {
|
|
364
|
+
margin: 2rem 0 0;
|
|
365
|
+
padding-top: 0.75rem;
|
|
366
|
+
border-top: 1px solid var(--rule);
|
|
367
|
+
text-align: center;
|
|
368
|
+
font-size: 0.8rem;
|
|
369
|
+
color: var(--muted);
|
|
370
|
+
}
|
|
371
|
+
.site-footer a { color: inherit; text-decoration: underline; text-decoration-color: var(--rule); }
|
|
372
|
+
.site-footer a:hover { color: var(--accent); text-decoration-color: var(--accent); }
|
|
373
|
+
|
|
282
374
|
.frontmatter-toggle {
|
|
283
375
|
display: inline-flex; align-items: center; gap: 0.35rem;
|
|
284
376
|
padding: 0.15rem 0.5rem;
|
|
@@ -407,7 +499,7 @@ article td > img:first-child:last-child {
|
|
|
407
499
|
/* Default size for ![[image]] embeds without an explicit |N hint. The
|
|
408
500
|
width itself is set by --default-img-width on <body>, configurable via
|
|
409
501
|
the default_image_width setting. */
|
|
410
|
-
article img.default-width { width: var(--default-img-width,
|
|
502
|
+
article img.default-width { width: var(--default-img-width, 300px); max-width: 100%; }
|
|
411
503
|
|
|
412
504
|
/* Centre images when settings.center_images is on. Scoped to standalone
|
|
413
505
|
<p><img></p> wrappers (Markdown emits these for image-only paragraphs)
|
|
@@ -752,6 +844,21 @@ article blockquote { margin: 1rem 0; padding: 0.5rem 1rem; border-left: 3px soli
|
|
|
752
844
|
.callout-dm { border-left-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); }
|
|
753
845
|
.callout-dm > .callout-title { color: var(--accent); }
|
|
754
846
|
|
|
847
|
+
/* Inline dice-roll buttons emitted by the built-in dice handler. */
|
|
848
|
+
button.dice-roll {
|
|
849
|
+
display: inline-block; padding: 0.05rem 0.5rem; margin: 0;
|
|
850
|
+
font: inherit; font-variant-numeric: tabular-nums;
|
|
851
|
+
background: var(--wikilink-bg); color: var(--accent);
|
|
852
|
+
border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
|
|
853
|
+
border-radius: 4px; cursor: pointer; line-height: 1.4;
|
|
854
|
+
}
|
|
855
|
+
button.dice-roll:hover { background: color-mix(in srgb, var(--accent) 12%, transparent); }
|
|
856
|
+
code.dice-roll-invalid { color: var(--muted); text-decoration: line-through; }
|
|
857
|
+
|
|
858
|
+
/* Inline frontmatter values emitted by the built-in fm handler when the
|
|
859
|
+
key is missing — visible so authors notice the typo. */
|
|
860
|
+
code.fm-missing { color: #b94a3a; background: color-mix(in srgb, #b94a3a 10%, transparent); }
|
|
861
|
+
|
|
755
862
|
/* Embed (transcluded ![[Page]]) */
|
|
756
863
|
.embed {
|
|
757
864
|
position: relative; border-left: 3px solid var(--accent-soft);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.js","sourceRoot":"","sources":["../../src/render/styles.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,2CAA2C;AAE3C
|
|
1
|
+
{"version":3,"file":"styles.js","sourceRoot":"","sources":["../../src/render/styles.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,2CAA2C;AAE3C;;;;;;;;;;GAUG;AACH,MAAM,UAAU,mBAAmB,CAAC,IAKnC;IACC,MAAM,MAAM,GAAa,EAAE,CAAC;IAC5B,IAAI,IAAI,CAAC,WAAW;QAAE,M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";
|
|
3
|
-
// Matches [[Page]], [[Page|alias]], [[Page#anchor]], [[Page#anchor|alias]]
|
|
4
|
-
//
|
|
5
|
-
|
|
3
|
+
// Matches [[Page]], [[Page|alias]], [[Page#anchor]], [[Page#anchor|alias]],
|
|
4
|
+
// and chained [[Page#H1#H2]] (Obsidian's nested-heading form). Negative
|
|
5
|
+
// lookbehind blocks ![[embed]] from being consumed here.
|
|
6
|
+
//
|
|
7
|
+
// The anchor capture allows `#` so chained headings parse as a single
|
|
8
|
+
// anchor string; the resolver below splits on `#` and uses the deepest
|
|
9
|
+
// segment for the URL fragment.
|
|
10
|
+
const WIKILINK_RE = /(?<!!)(?<!\[)\[\[([^\[\]|#\n]+?)(?:#([^\[\]|\n]+?))?(?:\|([^\[\]#\n]+?))?\]\]/g;
|
|
6
11
|
export function wikiLinkPlugin(opts) {
|
|
7
12
|
return () => (tree) => {
|
|
8
13
|
findAndReplace(tree, [
|
|
@@ -10,7 +15,13 @@ export function wikiLinkPlugin(opts) {
|
|
|
10
15
|
WIKILINK_RE,
|
|
11
16
|
(_match, rawName, rawAnchor, rawAlias) => {
|
|
12
17
|
const name = rawName.trim();
|
|
13
|
-
|
|
18
|
+
// Chained heading anchors like `H1#H2` resolve to the deepest segment
|
|
19
|
+
// (the actual heading the reader lands on); the URL fragment is just
|
|
20
|
+
// that final slug since rehype-slug emits one slug per heading.
|
|
21
|
+
const rawAnchorTrimmed = rawAnchor?.trim();
|
|
22
|
+
const anchor = rawAnchorTrimmed?.includes("#")
|
|
23
|
+
? rawAnchorTrimmed.split("#").map((s) => s.trim()).filter(Boolean).pop()
|
|
24
|
+
: rawAnchorTrimmed;
|
|
14
25
|
const display = rawAlias?.trim() ?? name;
|
|
15
26
|
const slug = slugify(name);
|
|
16
27
|
// Resolution order:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wikilink.js","sourceRoot":"","sources":["../../src/render/wikilink.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EA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,CAAC,CAAC;oBACzD,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,QAAQ;wBAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,aAAa,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;oBAEtF,0EAA0E;oBAC1E,0EAA0E;oBAC1E,mBAAmB;oBACnB,MAAM,SAAS,GAAG,IAAI,IAAI,IAAI;wBAC5B,CAAC,CAAC,CAAC,UAAU,EAAE,eAAe,CAAC;wBAC/B,CAAC,CAAC,CAAC,UAAU,EAAE,eAAe,EAAE,eAAe,EAAE,KAAK,CAAC,CAAC;oBAE1D,MAAM,IAAI,GAAS;wBACjB,IAAI,EAAE,MAAM;wBACZ,GAAG,EAAE,IAAI;wBACT,QAAQ,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAiB,CAAC;wBAC3D,IAAI,EAAE,EAAE,WAAW,EAAE,EAAE,SAAS,EAAE,EAAE;qBACrC,CAAC;oBACF,OAAO,IAAI,CAAC;gBACd,CAAC;aACF;SACF,CAAC,CAAC;IACL,CAAC,CAAC;AACJ,CAAC"}
|
package/dist/scan.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { readdir, readFile, stat } from "node:fs/promises";
|
|
2
2
|
import { createHash } from "node:crypto";
|
|
3
3
|
import { join, relative, sep } from "node:path";
|
|
4
|
-
const IGNORED_DIRS = new Set([".git", ".obsidian", ".trash", "node_modules", ".
|
|
4
|
+
const IGNORED_DIRS = new Set([".git", ".obsidian", ".trash", "node_modules", ".vaults"]);
|
|
5
5
|
const IGNORED_FILES = new Set([".DS_Store", ".vaultrc.json"]);
|
|
6
6
|
export async function scanVault(root) {
|
|
7
7
|
const out = [];
|
package/dist/scan.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scan.js","sourceRoot":"","sources":["../src/scan.ts"],"names":[],"mappings":"AAAA,OAAO,E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AC,KAAK,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;YAClD,KAAK;YACL,SAAS;SACV,CAAC,CAAC;IACL,CAAC;AACH,CAAC"}
|
package/dist/settings.js
CHANGED
|
@@ -28,9 +28,9 @@ const SCHEMA = {
|
|
|
28
28
|
description: "Inject the page title as an <h1> at the top. Set false if your notes already start with a '# Title' heading and you don't want the duplicate.",
|
|
29
29
|
},
|
|
30
30
|
default_image_width: {
|
|
31
|
-
default: "
|
|
31
|
+
default: "300px",
|
|
32
32
|
type: "string",
|
|
33
|
-
description: "CSS width applied to images embedded without an explicit '|N' size hint. Any valid CSS dimension works (
|
|
33
|
+
description: "CSS width applied to images embedded without an explicit '|N' size hint. Any valid CSS dimension works (300px, 50vw, 100%, etc). Set empty string to leave images at natural size.",
|
|
34
34
|
},
|
|
35
35
|
center_images: {
|
|
36
36
|
default: true,
|
|
@@ -50,7 +50,22 @@ const SCHEMA = {
|
|
|
50
50
|
bg_color: {
|
|
51
51
|
default: "",
|
|
52
52
|
type: "string",
|
|
53
|
-
description: "Override the background color. Any CSS color works: '#f4ecd8', 'wheat', 'rgb(244 236 216)'. Empty = use the built-in parchment.",
|
|
53
|
+
description: "Override the background color for the light palette. Any CSS color works: '#f4ecd8', 'wheat', 'rgb(244 236 216)'. Empty = use the built-in parchment.",
|
|
54
|
+
},
|
|
55
|
+
accent_color_dark: {
|
|
56
|
+
default: "",
|
|
57
|
+
type: "string",
|
|
58
|
+
description: "Override the accent color for the dark palette. Any CSS color works. Empty = use the built-in dark accent (a brighter scarlet).",
|
|
59
|
+
},
|
|
60
|
+
bg_color_dark: {
|
|
61
|
+
default: "",
|
|
62
|
+
type: "string",
|
|
63
|
+
description: "Override the background color for the dark palette. Any CSS color works. Empty = use the built-in deep warm dark.",
|
|
64
|
+
},
|
|
65
|
+
theme: {
|
|
66
|
+
default: "auto",
|
|
67
|
+
type: "string",
|
|
68
|
+
description: "Default colour theme: 'auto' (follows the visitor's OS preference), 'light' (parchment + scarlet), or 'dark'. Visitors can flip via the sidebar toggle; their choice persists in localStorage.",
|
|
54
69
|
},
|
|
55
70
|
favicon: {
|
|
56
71
|
default: "",
|
|
@@ -67,8 +82,14 @@ const SCHEMA = {
|
|
|
67
82
|
type: "boolean",
|
|
68
83
|
description: "Ship files with unrecognized extensions to every deploy variant. Default false skips them (with a warning) so a stray file in your vault can't accidentally bypass role gating. Recognized media types (audio/video/pdf/epub) are reference-gated like images regardless of this setting.",
|
|
69
84
|
},
|
|
85
|
+
footer: {
|
|
86
|
+
default: "Generated with [Wizzlethorpe Vaults](https://vaults.wizzlethorpe.com).",
|
|
87
|
+
type: "string",
|
|
88
|
+
description: "Markdown text rendered in a small <footer> at the bottom of every page. Supports inline markdown (links, *italic*, **bold**). Set to an empty string to hide the footer entirely.",
|
|
89
|
+
},
|
|
70
90
|
};
|
|
71
|
-
export
|
|
91
|
+
export { SETTINGS_FILE } from "./paths.js";
|
|
92
|
+
import { SETTINGS_FILE } from "./paths.js";
|
|
72
93
|
/**
|
|
73
94
|
* Read settings.md from a vault, normalise its values against the schema,
|
|
74
95
|
* fill defaults, and surface warnings for unknown keys.
|
package/dist/settings.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"settings.js","sourceRoot":"","sources":["../src/settings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,MAAM,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"settings.js","sourceRoot":"","sources":["../src/settings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,MAAM,MAAM,aAAa,CAAC;AAsCjC,MAAM,MAA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E,CAAC;QACH,CAAC;aAAM,CAAC;YACN,KAAK,CAAC,IAAI,CAAC,GAAG,GAAG,KAAK,YAAY,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QAC/C,CAAC;QACD,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACjB,CAAC;IACD,OAAO,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,KAAK,EAAE;QAAE,KAAK,CAAC,GAAG,EAAE,CAAC;IACnD,KAAK,CAAC,IAAI,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IACtB,KAAK,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;IAC/B,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACf,KAAK,CAAC,IAAI,CAAC,2EAA2E,CAAC,CAAC;IACxF,KAAK,CAAC,IAAI,CAAC,4CAA4C,CAAC,CAAC;IACzD,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACf,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC;AAED,SAAS,YAAY,CAAC,CAAU;IAC9B,IAAI,OAAO,CAAC,KAAK,QAAQ;QAAE,OAAO,YAAY,CAAC,CAAC,CAAC,CAAC;IAClD,OAAO,MAAM,CAAC,CAAC,CAAC,CAAC;AACnB,CAAC;AAED,SAAS,YAAY,CAAC,CAAS;IAC7B,OAAO,oBAAoB,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;AAC9D,CAAC"}
|
package/dist/version.js
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
// Single source of truth for the CLI's runtime-visible version.
|
|
2
|
+
//
|
|
3
|
+
// Read once at module load from package.json so a release-time bump
|
|
4
|
+
// propagates to:
|
|
5
|
+
// - `vaults --version`
|
|
6
|
+
// - the manifest's `cli_version` field (so synced clients can warn on
|
|
7
|
+
// skew between the CLI that built the deploy and the client reading it)
|
|
8
|
+
// - any future place that needs to identify the CLI's own version
|
|
9
|
+
//
|
|
10
|
+
// The manifest also carries `manifest_version` (incremented on breaking
|
|
11
|
+
// shape changes) and `id_scheme` (for entry-id derivation), declared here
|
|
12
|
+
// because they're protocol-level constants that travel with the CLI.
|
|
13
|
+
import { readFile } from "node:fs/promises";
|
|
14
|
+
import { fileURLToPath } from "node:url";
|
|
15
|
+
import { dirname, resolve } from "node:path";
|
|
16
|
+
const here = dirname(fileURLToPath(import.meta.url));
|
|
17
|
+
// Package.json sits next to dist/ at runtime, and next to src/ in dev.
|
|
18
|
+
const pkgPath = resolve(here, "..", "package.json");
|
|
19
|
+
const pkg = JSON.parse(await readFile(pkgPath, "utf8"));
|
|
20
|
+
export const CLI_VERSION = pkg.version;
|
|
21
|
+
/**
|
|
22
|
+
* Manifest schema/protocol version. Increment on breaking shape changes
|
|
23
|
+
* (renamed top-level fields, removed fields, semantic shifts). Additive
|
|
24
|
+
* changes don't bump it — clients should ignore unknown fields.
|
|
25
|
+
*/
|
|
26
|
+
export const MANIFEST_VERSION = 1;
|
|
27
|
+
/**
|
|
28
|
+
* Document-id derivation scheme, advertised in the manifest so a future
|
|
29
|
+
* algorithm change (e.g. SHA-1 → SHA-256, longer slice) can be detected
|
|
30
|
+
* by clients holding entries derived under an older scheme.
|
|
31
|
+
*
|
|
32
|
+
* "v1": SHA-1 of `vaults:<kind>:<vaultId>:<path>`, first 16 hex chars.
|
|
33
|
+
* Folder-keyed for entry IDs (one JournalEntry per folder).
|
|
34
|
+
*/
|
|
35
|
+
export const ID_SCHEME = "v1";
|
|
36
|
+
//# sourceMappingURL=version.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA,gEAAgE;AAChE,EAAE;AACF,oEAAoE;AACpE,iBAAiB;AACjB,yBAAyB;AACzB,wEAAwE;AACxE,4EAA4E;AAC5E,oEAAoE;AACpE,EAAE;AACF,wEAAwE;AACxE,0EAA0E;AAC1E,qEAAqE;AAErE,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAE7C,MAAM,IAAI,GAAG,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AACrD,uEAAuE;AACvE,MAAM,OAAO,GAAG,OAAO,CAAC,IAAI,EAAE,IAAI,EAAE,cAAc,CAAC,CAAC;AACpD,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC,CAAwB,CAAC;AAE/E,MAAM,CAAC,MAAM,WAAW,GAAW,GAAG,CAAC,OAAO,CAAC;AAE/C;;;;GAIG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAU,CAAC;AAE3C;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,IAAa,CAAC"}
|