@wizzlethorpe/vaults 0.6.1 → 0.7.1
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 +501 -190
- 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 +74 -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/battlemap.js +199 -0
- package/dist/render/handlers/builtin/battlemap.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 +13 -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 +38 -9
- package/dist/render/pipeline.js.map +1 -1
- package/dist/render/preview.js +53 -18
- 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 +124 -15
- 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
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dice.js","sourceRoot":"","sources":["../../../../src/render/handlers/builtin/dice.ts"],"names":[],"mappings":"AAAA,mCAAmC;AACnC,EAAE;AACF,mEAAmE;AACnE,EAAE;AACF,qEAAqE;AACrE,EAAE;AACF,0EAA0E;AAC1E,oEAAoE;AACpE,2EAA2E;AAC3E,kDAAkD;AAClD,EAAE;AACF,0EAA0E;AAC1E,oEAAoE;AAGpE,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAErD,6EAA6E;AAC7E,uEAAuE;AACvE,wEAAwE;AACxE,4DAA4D;AAC5D,MAAM,UAAU,GAAG,gCAAgC,CAAC;AAEpD,MAAM,CAAC,MAAM,WAAW,GAAkB;IACxC,MAAM,EAAE,MAAM;IACd,MAAM,CAAC,OAAe;QACpB,MAAM,OAAO,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC;QAC/B,MAAM,OAAO,GAAG,UAAU,CAAC,OAAO,CAAC,CAAC;QACpC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC;YAC9B,iEAAiE;YACjE,oDAAoD;YACpD,OAAO;gBACL,IAAI,EAAE,+EAA+E,OAAO,SAAS;aACtG,CAAC;QACJ,CAAC;QACD,OAAO;YACL,IAAI,EAAE,yDAAyD,OAAO,2BAA2B,OAAO,WAAW;SACpH,CAAC;IACJ,CAAC;CACF,CAAC;AAEF,6EAA6E;AAC7E,wEAAwE;AACxE,uEAAuE;AACvE,yDAAyD;AAEzD,MAAM,mBAAmB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgC3B,CAAC;AAEF,qBAAqB,CAAC,WAAW,EAAE;IACjC,OAAO,EAAE,CAAC,EAAE,MAAM,EAAE,yBAAyB,EAAE,OAAO,EAAE,mBAAmB,EAAE,CAAC;CAC/E,CAAC,CAAC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
// Built-in code-block `fm` handler — renders a frontmatter value as a fenced
|
|
2
|
+
// code block, with an optional language hint via the fence meta string.
|
|
3
|
+
//
|
|
4
|
+
// Usage:
|
|
5
|
+
//
|
|
6
|
+
// ```fm javascript
|
|
7
|
+
// foundry.data.command
|
|
8
|
+
// ```
|
|
9
|
+
//
|
|
10
|
+
// Renders as:
|
|
11
|
+
//
|
|
12
|
+
// <pre><code class="language-javascript">…value of frontmatter.foundry.data.command…</code></pre>
|
|
13
|
+
//
|
|
14
|
+
// Companion to the inline `fm:` handler. Inline form is used in prose to
|
|
15
|
+
// pull a frontmatter value into a sentence; this code-block form is used
|
|
16
|
+
// when the value IS code (or otherwise wants a `<pre>` wrapper) and you
|
|
17
|
+
// want a single source of truth for that code rather than duplicating it
|
|
18
|
+
// between the frontmatter and the page body.
|
|
19
|
+
//
|
|
20
|
+
// The body of the fence is the dot-path (single token, leading/trailing
|
|
21
|
+
// whitespace tolerated). Anything beyond the lang on the fence is the
|
|
22
|
+
// optional language hint — `lang className="language-…"` so client-side
|
|
23
|
+
// highlighters can pick it up. Missing path or non-string value renders
|
|
24
|
+
// as a visible warning marker rather than failing the build, same policy
|
|
25
|
+
// as the inline handler.
|
|
26
|
+
import { htmlEscape } from "../../../escape.js";
|
|
27
|
+
import { lookup } from "./fm.js";
|
|
28
|
+
export const fmCodeHandler = {
|
|
29
|
+
codeBlock: "fm",
|
|
30
|
+
render(content, ctx) {
|
|
31
|
+
const path = content.trim();
|
|
32
|
+
if (!path)
|
|
33
|
+
return missing("(empty)");
|
|
34
|
+
const value = lookup(ctx.frontmatter, path);
|
|
35
|
+
if (typeof value !== "string")
|
|
36
|
+
return missing(`${path}: not a string`);
|
|
37
|
+
const langClass = ctx.codeBlockMeta
|
|
38
|
+
? ` class="language-${htmlEscape(ctx.codeBlockMeta)}"`
|
|
39
|
+
: "";
|
|
40
|
+
return {
|
|
41
|
+
html: `<pre><code${langClass}>${htmlEscape(value)}</code></pre>`,
|
|
42
|
+
};
|
|
43
|
+
},
|
|
44
|
+
};
|
|
45
|
+
function missing(key) {
|
|
46
|
+
return {
|
|
47
|
+
html: `<pre><code class="fm-missing" title="frontmatter key not found">{{${htmlEscape(key)}}}</code></pre>`,
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=fm-code.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fm-code.js","sourceRoot":"","sources":["../../../../src/render/handlers/builtin/fm-code.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,wEAAwE;AACxE,EAAE;AACF,SAAS;AACT,EAAE;AACF,qBAAqB;AACrB,yBAAyB;AACzB,QAAQ;AACR,EAAE;AACF,cAAc;AACd,EAAE;AACF,oGAAoG;AACpG,EAAE;AACF,yEAAyE;AACzE,yEAAyE;AACzE,wEAAwE;AACxE,yEAAyE;AACzE,6CAA6C;AAC7C,EAAE;AACF,wEAAwE;AACxE,sEAAsE;AACtE,wEAAwE;AACxE,wEAAwE;AACxE,yEAAyE;AACzE,yBAAyB;AAGzB,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAEjC,MAAM,CAAC,MAAM,aAAa,GAAqB;IAC7C,SAAS,EAAE,IAAI;IACf,MAAM,CAAC,OAAO,EAAE,GAAG;QACjB,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC;QAC5B,IAAI,CAAC,IAAI;YAAE,OAAO,OAAO,CAAC,SAAS,CAAC,CAAC;QACrC,MAAM,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC;QAC5C,IAAI,OAAO,KAAK,KAAK,QAAQ;YAAE,OAAO,OAAO,CAAC,GAAG,IAAI,gBAAgB,CAAC,CAAC;QACvE,MAAM,SAAS,GAAG,GAAG,CAAC,aAAa;YACjC,CAAC,CAAC,oBAAoB,UAAU,CAAC,GAAG,CAAC,aAAa,CAAC,GAAG;YACtD,CAAC,CAAC,EAAE,CAAC;QACP,OAAO;YACL,IAAI,EAAE,aAAa,SAAS,IAAI,UAAU,CAAC,KAAK,CAAC,eAAe;SACjE,CAAC;IACJ,CAAC;CACF,CAAC;AAEF,SAAS,OAAO,CAAC,GAAW;IAC1B,OAAO;QACL,IAAI,EAAE,qEAAqE,UAAU,CAAC,GAAG,CAAC,iBAAiB;KAC5G,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
// Built-in inline `fm:` handler — inserts a frontmatter value into prose.
|
|
2
|
+
//
|
|
3
|
+
// ---
|
|
4
|
+
// class: Wizard
|
|
5
|
+
// level: 7
|
|
6
|
+
// stats:
|
|
7
|
+
// hp: 22
|
|
8
|
+
// ---
|
|
9
|
+
// The `fm: class` is level `fm: level` with `fm: stats.hp` HP.
|
|
10
|
+
//
|
|
11
|
+
// Renders as: "The Wizard is level 7 with 22 HP."
|
|
12
|
+
//
|
|
13
|
+
// Dot-path lookups (`fm: a.b.c`) walk nested objects. Keys with literal
|
|
14
|
+
// dots in their names are unreachable, which we accept because such keys
|
|
15
|
+
// are vanishingly rare in vault frontmatter.
|
|
16
|
+
//
|
|
17
|
+
// String/number/boolean values render as HTML with a small inline-markup
|
|
18
|
+
// pass (**bold**, *italic*, `code`) so authors can put light formatting
|
|
19
|
+
// in frontmatter and have it survive. Returning HTML rather than markdown
|
|
20
|
+
// lets fm work when invoked recursively from another handler (e.g. inside
|
|
21
|
+
// a `statblock` field), since the dispatcher only re-pipelines top-level
|
|
22
|
+
// markdown returns. Wikilinks in frontmatter are NOT processed; cross-page
|
|
23
|
+
// reference belongs in prose.
|
|
24
|
+
//
|
|
25
|
+
// Dates (YAML auto-parses ISO 8601 strings to Date) format as YYYY-MM-DD.
|
|
26
|
+
// Arrays are joined with ", ". Missing keys and unsupported value shapes
|
|
27
|
+
// (plain objects, null) render a visible warning marker so the page
|
|
28
|
+
// surfaces the problem instead of silently emitting "undefined".
|
|
29
|
+
import { htmlEscape } from "../../../escape.js";
|
|
30
|
+
import { formatInline } from "./inline-format.js";
|
|
31
|
+
export const fmHandler = {
|
|
32
|
+
inline: "fm",
|
|
33
|
+
render(content, ctx) {
|
|
34
|
+
const path = content.trim();
|
|
35
|
+
if (!path)
|
|
36
|
+
return missing("(empty)");
|
|
37
|
+
const value = lookup(ctx.frontmatter, path);
|
|
38
|
+
const formatted = formatScalar(value);
|
|
39
|
+
if (formatted !== null)
|
|
40
|
+
return { html: wrap(formatInline(formatted)) };
|
|
41
|
+
if (Array.isArray(value)) {
|
|
42
|
+
return { html: wrap(formatInline(value.map((v) => formatScalar(v) ?? "").join(", "))) };
|
|
43
|
+
}
|
|
44
|
+
return missing(path);
|
|
45
|
+
},
|
|
46
|
+
};
|
|
47
|
+
// Bare-text HTML AST nodes get dropped by the markdown → HTML stage
|
|
48
|
+
// (rehype-raw needs an actual element to anchor onto in inline contexts);
|
|
49
|
+
// wrapping in a <span> keeps the value visible. The span is invisible in
|
|
50
|
+
// the final layout so it doesn't change typography.
|
|
51
|
+
function wrap(inner) { return `<span class="fm-value">${inner}</span>`; }
|
|
52
|
+
/** Walk a dot-path into the page's frontmatter; numeric segments index
|
|
53
|
+
* arrays. Exported so the sibling fm code-block handler reuses the same
|
|
54
|
+
* resolution semantics. */
|
|
55
|
+
export function lookup(root, path) {
|
|
56
|
+
const segments = path.split(".");
|
|
57
|
+
let cursor = root;
|
|
58
|
+
for (const seg of segments) {
|
|
59
|
+
if (cursor === null || cursor === undefined)
|
|
60
|
+
return undefined;
|
|
61
|
+
if (typeof cursor !== "object")
|
|
62
|
+
return undefined;
|
|
63
|
+
cursor = cursor[seg];
|
|
64
|
+
}
|
|
65
|
+
return cursor;
|
|
66
|
+
}
|
|
67
|
+
function formatScalar(v) {
|
|
68
|
+
if (v === null || v === undefined)
|
|
69
|
+
return null;
|
|
70
|
+
if (typeof v === "string")
|
|
71
|
+
return v;
|
|
72
|
+
if (typeof v === "number" || typeof v === "boolean")
|
|
73
|
+
return String(v);
|
|
74
|
+
if (v instanceof Date && !isNaN(v.getTime()))
|
|
75
|
+
return v.toISOString().slice(0, 10);
|
|
76
|
+
return null;
|
|
77
|
+
}
|
|
78
|
+
function missing(key) {
|
|
79
|
+
return {
|
|
80
|
+
html: `<code class="fm-missing" title="frontmatter key not found">{{${htmlEscape(key)}}}</code>`,
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
//# sourceMappingURL=fm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fm.js","sourceRoot":"","sources":["../../../../src/render/handlers/builtin/fm.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// Registry of built-in handlers shipped with vaults-cli.
|
|
2
|
+
//
|
|
3
|
+
// User-defined handlers (loaded from .vaults/handlers/) override built-ins
|
|
4
|
+
// of the same name; see buildRegistry() in handlers/types.ts.
|
|
5
|
+
import { battlemapHandler } from "./battlemap.js";
|
|
6
|
+
import { diceHandler } from "./dice.js";
|
|
7
|
+
import { fmHandler } from "./fm.js";
|
|
8
|
+
import { fmCodeHandler } from "./fm-code.js";
|
|
9
|
+
import { statblockHandler } from "./statblock.js";
|
|
10
|
+
export const BUILTIN_HANDLERS = [
|
|
11
|
+
diceHandler, fmHandler, fmCodeHandler, statblockHandler, battlemapHandler,
|
|
12
|
+
];
|
|
13
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/render/handlers/builtin/index.ts"],"names":[],"mappings":"AAAA,yDAAyD;AACzD,EAAE;AACF,2EAA2E;AAC3E,8DAA8D;AAG9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAElD,MAAM,CAAC,MAAM,gBAAgB,GAAc;IACzC,WAAW,EAAE,SAAS,EAAE,aAAa,EAAE,gBAAgB,EAAE,gBAAgB;CAC1E,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// Tiny inline-markdown formatter shared by the built-in `fm` and `statblock`
|
|
2
|
+
// handlers. Both render frontmatter scalars or bespoke content directly to
|
|
3
|
+
// HTML rather than re-feeding it through the full markdown pipeline, but
|
|
4
|
+
// authors still expect basic ** ** / * * / `` markup to survive. This is
|
|
5
|
+
// the smallest formatter that supports that.
|
|
6
|
+
//
|
|
7
|
+
// Bold runs first (** **) so the italic regex can't gobble its asterisks.
|
|
8
|
+
// Italic uses a leading non-`*` guard so `**bold**` doesn't match. Code
|
|
9
|
+
// spans run last; their delimiter (`) is HTML-safe after htmlEscape.
|
|
10
|
+
//
|
|
11
|
+
// Wikilinks are intentionally NOT processed here — wikilink resolution
|
|
12
|
+
// requires the full RenderContext and lives in render/wikilink.ts. Authors
|
|
13
|
+
// who need wikilinks should put them in regular prose.
|
|
14
|
+
import { htmlEscape } from "../../../escape.js";
|
|
15
|
+
/**
|
|
16
|
+
* HTML-escape `s`, then apply a small inline-markdown subset
|
|
17
|
+
* (bold, italic, code spans). Returns ready-to-insert HTML.
|
|
18
|
+
*/
|
|
19
|
+
export function formatInline(s) {
|
|
20
|
+
let out = htmlEscape(s);
|
|
21
|
+
out = out.replace(/\*\*([^*]+)\*\*/g, "<strong>$1</strong>");
|
|
22
|
+
out = out.replace(/(^|[^*])\*([^*\n]+)\*(?!\*)/g, "$1<em>$2</em>");
|
|
23
|
+
out = out.replace(/`([^`]+)`/g, "<code>$1</code>");
|
|
24
|
+
return out;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=inline-format.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inline-format.js","sourceRoot":"","sources":["../../../../src/render/handlers/builtin/inline-format.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,2EAA2E;AAC3E,yEAAyE;AACzE,yEAAyE;AACzE,6CAA6C;AAC7C,EAAE;AACF,0EAA0E;AAC1E,wEAAwE;AACxE,qEAAqE;AACrE,EAAE;AACF,uEAAuE;AACvE,2EAA2E;AAC3E,uDAAuD;AAEvD,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEhD;;;GAGG;AACH,MAAM,UAAU,YAAY,CAAC,CAAS;IACpC,IAAI,GAAG,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC;IACxB,GAAG,GAAG,GAAG,CAAC,OAAO,CAAC,kBAAkB,EAAE,qBAAqB,CAAC,CAAC;IAC7D,GAAG,GAAG,GAAG,CAAC,OAAO,CAAC,8BAA8B,EAAE,eAAe,CAAC,CAAC;IACnE,GAAG,GAAG,GAAG,CAAC,OAAO,CAAC,YAAY,EAAE,iBAAiB,CAAC,CAAC;IACnD,OAAO,GAAG,CAAC;AACb,CAAC"}
|