@prudentbird/voxx-core 1.0.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 +42 -0
- package/dist/_virtual/_rolldown/runtime.cjs +23 -0
- package/dist/config.cjs +151 -0
- package/dist/config.cjs.map +1 -0
- package/dist/config.d.cts +122 -0
- package/dist/config.d.cts.map +1 -0
- package/dist/config.d.mts +122 -0
- package/dist/config.d.mts.map +1 -0
- package/dist/config.mjs +149 -0
- package/dist/config.mjs.map +1 -0
- package/dist/content.cjs +147 -0
- package/dist/content.cjs.map +1 -0
- package/dist/content.d.cts +41 -0
- package/dist/content.d.cts.map +1 -0
- package/dist/content.d.mts +41 -0
- package/dist/content.d.mts.map +1 -0
- package/dist/content.mjs +145 -0
- package/dist/content.mjs.map +1 -0
- package/dist/dev.cjs +82 -0
- package/dist/dev.cjs.map +1 -0
- package/dist/dev.d.cts +24 -0
- package/dist/dev.d.cts.map +1 -0
- package/dist/dev.d.mts +24 -0
- package/dist/dev.d.mts.map +1 -0
- package/dist/dev.mjs +82 -0
- package/dist/dev.mjs.map +1 -0
- package/dist/effect.cjs +23 -0
- package/dist/effect.d.cts +8 -0
- package/dist/effect.d.mts +8 -0
- package/dist/effect.mjs +8 -0
- package/dist/errors.cjs +20 -0
- package/dist/errors.cjs.map +1 -0
- package/dist/errors.d.cts +45 -0
- package/dist/errors.d.cts.map +1 -0
- package/dist/errors.d.mts +45 -0
- package/dist/errors.d.mts.map +1 -0
- package/dist/errors.mjs +16 -0
- package/dist/errors.mjs.map +1 -0
- package/dist/feeds.cjs +97 -0
- package/dist/feeds.cjs.map +1 -0
- package/dist/feeds.d.cts +49 -0
- package/dist/feeds.d.cts.map +1 -0
- package/dist/feeds.d.mts +49 -0
- package/dist/feeds.d.mts.map +1 -0
- package/dist/feeds.mjs +94 -0
- package/dist/feeds.mjs.map +1 -0
- package/dist/frontmatter.cjs +22 -0
- package/dist/frontmatter.cjs.map +1 -0
- package/dist/frontmatter.d.cts +30 -0
- package/dist/frontmatter.d.cts.map +1 -0
- package/dist/frontmatter.d.mts +30 -0
- package/dist/frontmatter.d.mts.map +1 -0
- package/dist/frontmatter.mjs +20 -0
- package/dist/frontmatter.mjs.map +1 -0
- package/dist/index.cjs +90 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +50 -0
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.mts +50 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +59 -0
- package/dist/index.mjs.map +1 -0
- package/dist/llms.cjs +81 -0
- package/dist/llms.cjs.map +1 -0
- package/dist/llms.d.cts +43 -0
- package/dist/llms.d.cts.map +1 -0
- package/dist/llms.d.mts +43 -0
- package/dist/llms.d.mts.map +1 -0
- package/dist/llms.mjs +78 -0
- package/dist/llms.mjs.map +1 -0
- package/dist/nav.cjs +50 -0
- package/dist/nav.cjs.map +1 -0
- package/dist/nav.d.cts +16 -0
- package/dist/nav.d.cts.map +1 -0
- package/dist/nav.d.mts +16 -0
- package/dist/nav.d.mts.map +1 -0
- package/dist/nav.mjs +50 -0
- package/dist/nav.mjs.map +1 -0
- package/dist/render.cjs +152 -0
- package/dist/render.cjs.map +1 -0
- package/dist/render.d.cts +29 -0
- package/dist/render.d.cts.map +1 -0
- package/dist/render.d.mts +29 -0
- package/dist/render.d.mts.map +1 -0
- package/dist/render.mjs +143 -0
- package/dist/render.mjs.map +1 -0
- package/dist/schema.cjs +78 -0
- package/dist/schema.cjs.map +1 -0
- package/dist/schema.d.cts +93 -0
- package/dist/schema.d.cts.map +1 -0
- package/dist/schema.d.mts +93 -0
- package/dist/schema.d.mts.map +1 -0
- package/dist/schema.mjs +77 -0
- package/dist/schema.mjs.map +1 -0
- package/dist/seo.cjs +77 -0
- package/dist/seo.cjs.map +1 -0
- package/dist/seo.d.cts +15 -0
- package/dist/seo.d.cts.map +1 -0
- package/dist/seo.d.mts +15 -0
- package/dist/seo.d.mts.map +1 -0
- package/dist/seo.mjs +77 -0
- package/dist/seo.mjs.map +1 -0
- package/dist/types.cjs +45 -0
- package/dist/types.cjs.map +1 -0
- package/dist/types.d.cts +138 -0
- package/dist/types.d.cts.map +1 -0
- package/dist/types.d.mts +138 -0
- package/dist/types.d.mts.map +1 -0
- package/dist/types.mjs +45 -0
- package/dist/types.mjs.map +1 -0
- package/dist/util.cjs +185 -0
- package/dist/util.cjs.map +1 -0
- package/dist/util.d.cts +98 -0
- package/dist/util.d.cts.map +1 -0
- package/dist/util.d.mts +98 -0
- package/dist/util.d.mts.map +1 -0
- package/dist/util.mjs +171 -0
- package/dist/util.mjs.map +1 -0
- package/package.json +106 -0
- package/theme/demo-globals.css +61 -0
- package/theme/voxx.css +915 -0
- package/voxx.schema.json +186 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
const require_runtime = require("./_virtual/_rolldown/runtime.cjs");
|
|
2
|
+
const require_schema = require("./schema.cjs");
|
|
3
|
+
const require_errors = require("./errors.cjs");
|
|
4
|
+
let effect = require("effect");
|
|
5
|
+
let gray_matter = require("gray-matter");
|
|
6
|
+
gray_matter = require_runtime.__toESM(gray_matter, 1);
|
|
7
|
+
//#region src/frontmatter.ts
|
|
8
|
+
const parseFrontmatter = (file, raw) => effect.Effect.gen(function* () {
|
|
9
|
+
const parsed = (0, gray_matter.default)(raw);
|
|
10
|
+
return {
|
|
11
|
+
data: yield* effect.Schema.decodeUnknown(require_schema.Frontmatter)(parsed.data).pipe(effect.Effect.mapError((cause) => new require_errors.InvalidFrontmatter({
|
|
12
|
+
file,
|
|
13
|
+
message: effect.ParseResult.TreeFormatter.formatErrorSync(cause),
|
|
14
|
+
cause
|
|
15
|
+
}))),
|
|
16
|
+
content: parsed.content
|
|
17
|
+
};
|
|
18
|
+
});
|
|
19
|
+
//#endregion
|
|
20
|
+
exports.parseFrontmatter = parseFrontmatter;
|
|
21
|
+
|
|
22
|
+
//# sourceMappingURL=frontmatter.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"frontmatter.cjs","names":["Effect","Schema","Frontmatter","InvalidFrontmatter","ParseResult"],"sources":["../src/frontmatter.ts"],"sourcesContent":["import { Effect, ParseResult, Schema } from \"effect\";\nimport matter from \"gray-matter\";\nimport { Frontmatter, type FrontmatterData } from \"./schema\";\nimport { InvalidFrontmatter } from \"./errors\";\n\nexport interface ParsedFile {\n data: FrontmatterData;\n content: string;\n}\n\nexport const parseFrontmatter = (file: string, raw: string) =>\n Effect.gen(function* () {\n const parsed = matter(raw);\n const data = yield* Schema.decodeUnknown(Frontmatter)(parsed.data).pipe(\n Effect.mapError(\n (cause) =>\n new InvalidFrontmatter({\n file,\n message: ParseResult.TreeFormatter.formatErrorSync(cause),\n cause,\n }),\n ),\n );\n return { data, content: parsed.content } satisfies ParsedFile;\n });\n"],"mappings":";;;;;;;AAUA,MAAa,oBAAoB,MAAc,QAC7CA,OAAAA,OAAO,IAAI,aAAa;CACtB,MAAM,UAAA,GAAA,YAAA,QAAA,CAAgB,GAAG;CAWzB,OAAO;EAAE,MAAA,OAVWC,OAAAA,OAAO,cAAcC,eAAAA,WAAW,CAAC,CAAC,OAAO,IAAI,CAAC,CAAC,KACjEF,OAAAA,OAAO,UACJ,UACC,IAAIG,eAAAA,mBAAmB;GACrB;GACA,SAASC,OAAAA,YAAY,cAAc,gBAAgB,KAAK;GACxD;EACF,CAAC,CACL,CACF;EACe,SAAS,OAAO;CAAQ;AACzC,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { InvalidFrontmatter } from "./errors.cjs";
|
|
2
|
+
import { FrontmatterData } from "./schema.cjs";
|
|
3
|
+
import { Effect } from "effect";
|
|
4
|
+
|
|
5
|
+
//#region src/frontmatter.d.ts
|
|
6
|
+
interface ParsedFile {
|
|
7
|
+
data: FrontmatterData;
|
|
8
|
+
content: string;
|
|
9
|
+
}
|
|
10
|
+
declare const parseFrontmatter: (file: string, raw: string) => Effect.Effect<{
|
|
11
|
+
data: {
|
|
12
|
+
readonly title: string;
|
|
13
|
+
readonly description?: string | undefined;
|
|
14
|
+
readonly date?: string | undefined;
|
|
15
|
+
readonly updated?: string | undefined;
|
|
16
|
+
readonly slug?: string | undefined;
|
|
17
|
+
readonly tags: readonly string[];
|
|
18
|
+
readonly category?: string | undefined;
|
|
19
|
+
readonly order?: number | undefined;
|
|
20
|
+
readonly version?: string | undefined;
|
|
21
|
+
readonly draft: boolean;
|
|
22
|
+
readonly image?: string | undefined;
|
|
23
|
+
readonly author?: string | undefined;
|
|
24
|
+
readonly excerpt?: string | undefined;
|
|
25
|
+
};
|
|
26
|
+
content: string;
|
|
27
|
+
}, InvalidFrontmatter, never>;
|
|
28
|
+
//#endregion
|
|
29
|
+
export { ParsedFile, parseFrontmatter };
|
|
30
|
+
//# sourceMappingURL=frontmatter.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"frontmatter.d.cts","names":[],"sources":["../src/frontmatter.ts"],"mappings":";;;;;UAKiB,UAAA;EACf,IAAA,EAAM,eAAe;EACrB,OAAA;AAAA;AAAA,cAGW,gBAAA,GAAoB,IAAA,UAAc,GAAA,aAAW,MAAA,CAAA,MAAA;;;;;;;;;;;;;;;;;GActD,kBAAA"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { InvalidFrontmatter } from "./errors.mjs";
|
|
2
|
+
import { FrontmatterData } from "./schema.mjs";
|
|
3
|
+
import { Effect } from "effect";
|
|
4
|
+
|
|
5
|
+
//#region src/frontmatter.d.ts
|
|
6
|
+
interface ParsedFile {
|
|
7
|
+
data: FrontmatterData;
|
|
8
|
+
content: string;
|
|
9
|
+
}
|
|
10
|
+
declare const parseFrontmatter: (file: string, raw: string) => Effect.Effect<{
|
|
11
|
+
data: {
|
|
12
|
+
readonly title: string;
|
|
13
|
+
readonly description?: string | undefined;
|
|
14
|
+
readonly date?: string | undefined;
|
|
15
|
+
readonly updated?: string | undefined;
|
|
16
|
+
readonly slug?: string | undefined;
|
|
17
|
+
readonly tags: readonly string[];
|
|
18
|
+
readonly category?: string | undefined;
|
|
19
|
+
readonly order?: number | undefined;
|
|
20
|
+
readonly version?: string | undefined;
|
|
21
|
+
readonly draft: boolean;
|
|
22
|
+
readonly image?: string | undefined;
|
|
23
|
+
readonly author?: string | undefined;
|
|
24
|
+
readonly excerpt?: string | undefined;
|
|
25
|
+
};
|
|
26
|
+
content: string;
|
|
27
|
+
}, InvalidFrontmatter, never>;
|
|
28
|
+
//#endregion
|
|
29
|
+
export { ParsedFile, parseFrontmatter };
|
|
30
|
+
//# sourceMappingURL=frontmatter.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"frontmatter.d.mts","names":[],"sources":["../src/frontmatter.ts"],"mappings":";;;;;UAKiB,UAAA;EACf,IAAA,EAAM,eAAe;EACrB,OAAA;AAAA;AAAA,cAGW,gBAAA,GAAoB,IAAA,UAAc,GAAA,aAAW,MAAA,CAAA,MAAA;;;;;;;;;;;;;;;;;GActD,kBAAA"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Frontmatter } from "./schema.mjs";
|
|
2
|
+
import { InvalidFrontmatter } from "./errors.mjs";
|
|
3
|
+
import { Effect, ParseResult, Schema } from "effect";
|
|
4
|
+
import matter from "gray-matter";
|
|
5
|
+
//#region src/frontmatter.ts
|
|
6
|
+
const parseFrontmatter = (file, raw) => Effect.gen(function* () {
|
|
7
|
+
const parsed = matter(raw);
|
|
8
|
+
return {
|
|
9
|
+
data: yield* Schema.decodeUnknown(Frontmatter)(parsed.data).pipe(Effect.mapError((cause) => new InvalidFrontmatter({
|
|
10
|
+
file,
|
|
11
|
+
message: ParseResult.TreeFormatter.formatErrorSync(cause),
|
|
12
|
+
cause
|
|
13
|
+
}))),
|
|
14
|
+
content: parsed.content
|
|
15
|
+
};
|
|
16
|
+
});
|
|
17
|
+
//#endregion
|
|
18
|
+
export { parseFrontmatter };
|
|
19
|
+
|
|
20
|
+
//# sourceMappingURL=frontmatter.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"frontmatter.mjs","names":[],"sources":["../src/frontmatter.ts"],"sourcesContent":["import { Effect, ParseResult, Schema } from \"effect\";\nimport matter from \"gray-matter\";\nimport { Frontmatter, type FrontmatterData } from \"./schema\";\nimport { InvalidFrontmatter } from \"./errors\";\n\nexport interface ParsedFile {\n data: FrontmatterData;\n content: string;\n}\n\nexport const parseFrontmatter = (file: string, raw: string) =>\n Effect.gen(function* () {\n const parsed = matter(raw);\n const data = yield* Schema.decodeUnknown(Frontmatter)(parsed.data).pipe(\n Effect.mapError(\n (cause) =>\n new InvalidFrontmatter({\n file,\n message: ParseResult.TreeFormatter.formatErrorSync(cause),\n cause,\n }),\n ),\n );\n return { data, content: parsed.content } satisfies ParsedFile;\n });\n"],"mappings":";;;;;AAUA,MAAa,oBAAoB,MAAc,QAC7C,OAAO,IAAI,aAAa;CACtB,MAAM,SAAS,OAAO,GAAG;CAWzB,OAAO;EAAE,MAAA,OAVW,OAAO,cAAc,WAAW,CAAC,CAAC,OAAO,IAAI,CAAC,CAAC,KACjE,OAAO,UACJ,UACC,IAAI,mBAAmB;GACrB;GACA,SAAS,YAAY,cAAc,gBAAgB,KAAK;GACxD;EACF,CAAC,CACL,CACF;EACe,SAAS,OAAO;CAAQ;AACzC,CAAC"}
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_types = require("./types.cjs");
|
|
3
|
+
const require_config = require("./config.cjs");
|
|
4
|
+
const require_render = require("./render.cjs");
|
|
5
|
+
const require_util = require("./util.cjs");
|
|
6
|
+
const require_content = require("./content.cjs");
|
|
7
|
+
const require_seo = require("./seo.cjs");
|
|
8
|
+
const require_feeds = require("./feeds.cjs");
|
|
9
|
+
const require_llms = require("./llms.cjs");
|
|
10
|
+
const require_dev = require("./dev.cjs");
|
|
11
|
+
const require_nav = require("./nav.cjs");
|
|
12
|
+
let effect = require("effect");
|
|
13
|
+
let _effect_platform_node = require("@effect/platform-node");
|
|
14
|
+
//#region src/index.ts
|
|
15
|
+
const run = (effect$1) => effect.Effect.runPromise(effect.Effect.provide(effect$1, _effect_platform_node.NodeContext.layer));
|
|
16
|
+
/**
|
|
17
|
+
* Reads and validates `voxx.json` from disk.
|
|
18
|
+
*
|
|
19
|
+
* @param opts - Optional `cwd` or explicit config file `path`.
|
|
20
|
+
* @returns Fully resolved `VoxxConfig`.
|
|
21
|
+
*/
|
|
22
|
+
function loadConfig(opts) {
|
|
23
|
+
return run(require_config.loadConfigEffect(opts));
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Returns all published posts for the active collection, sorted by the
|
|
27
|
+
* collection type's natural order (date, semver, or manual order prefix).
|
|
28
|
+
*
|
|
29
|
+
* @param opts - Collection filter, draft visibility, and optional pre-loaded config.
|
|
30
|
+
*/
|
|
31
|
+
function getPosts(opts = {}) {
|
|
32
|
+
return run(effect.Effect.gen(function* () {
|
|
33
|
+
return yield* require_content.getPostsEffect(opts.config ?? (yield* require_config.loadConfigEffect(opts)), opts);
|
|
34
|
+
}));
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Returns a single post by slug.
|
|
38
|
+
*
|
|
39
|
+
* @param slug - Slash-separated path, e.g. `"getting-started/install"`.
|
|
40
|
+
* @param opts - Collection filter, draft visibility, and optional pre-loaded config.
|
|
41
|
+
* @throws `PostNotFound` if no matching post exists.
|
|
42
|
+
*/
|
|
43
|
+
function getPost(slug, opts = {}) {
|
|
44
|
+
return run(effect.Effect.gen(function* () {
|
|
45
|
+
return yield* require_content.getPostEffect(opts.config ?? (yield* require_config.loadConfigEffect(opts)), slug, opts);
|
|
46
|
+
}));
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Converts a Markdown string to HTML with syntax highlighting and TOC extraction.
|
|
50
|
+
*
|
|
51
|
+
* @param markdown - Raw Markdown source.
|
|
52
|
+
* @param config - Voxx config (controls code theme). Defaults to `DEFAULT_CONFIG`.
|
|
53
|
+
*/
|
|
54
|
+
function renderMarkdown(markdown, config = require_types.DEFAULT_CONFIG) {
|
|
55
|
+
return run(require_render.renderMarkdownEffect(markdown, config));
|
|
56
|
+
}
|
|
57
|
+
//#endregion
|
|
58
|
+
exports.DEFAULT_CONFIG = require_types.DEFAULT_CONFIG;
|
|
59
|
+
exports.absoluteUrl = require_util.absoluteUrl;
|
|
60
|
+
exports.buildNavTree = require_nav.buildNavTree;
|
|
61
|
+
exports.buildSeo = require_seo.buildSeo;
|
|
62
|
+
exports.compareVersions = require_util.compareVersions;
|
|
63
|
+
exports.deriveExcerpt = require_util.deriveExcerpt;
|
|
64
|
+
exports.escapeXml = require_util.escapeXml;
|
|
65
|
+
exports.findPost = require_content.findPost;
|
|
66
|
+
exports.formatDate = require_util.formatDate;
|
|
67
|
+
exports.getPost = getPost;
|
|
68
|
+
exports.getPosts = getPosts;
|
|
69
|
+
exports.humanize = require_util.humanize;
|
|
70
|
+
exports.joinPath = require_util.joinPath;
|
|
71
|
+
exports.loadConfig = loadConfig;
|
|
72
|
+
exports.parseVersion = require_util.parseVersion;
|
|
73
|
+
exports.readingTimeMinutes = require_util.readingTimeMinutes;
|
|
74
|
+
exports.registerContentWatcher = require_dev.registerContentWatcher;
|
|
75
|
+
exports.renderLlmsFull = require_llms.renderLlmsFull;
|
|
76
|
+
exports.renderLlmsTxt = require_llms.renderLlmsTxt;
|
|
77
|
+
exports.renderLlmsTxtSections = require_llms.renderLlmsTxtSections;
|
|
78
|
+
exports.renderMarkdown = renderMarkdown;
|
|
79
|
+
exports.renderRobotsTxt = require_feeds.renderRobotsTxt;
|
|
80
|
+
exports.renderRss = require_feeds.renderRss;
|
|
81
|
+
exports.renderSitemap = require_feeds.renderSitemap;
|
|
82
|
+
exports.resolveCollectionDefaults = require_config.resolveCollectionDefaults;
|
|
83
|
+
exports.rssPath = require_feeds.rssPath;
|
|
84
|
+
exports.sectionHeading = require_llms.sectionHeading;
|
|
85
|
+
exports.serializeJsonLd = require_util.serializeJsonLd;
|
|
86
|
+
exports.slugify = require_util.slugify;
|
|
87
|
+
exports.splitDatePrefix = require_util.splitDatePrefix;
|
|
88
|
+
exports.splitOrderPrefix = require_util.splitOrderPrefix;
|
|
89
|
+
|
|
90
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["Effect","effect","NodeContext","loadConfigEffect","getPostsEffect","getPostEffect","DEFAULT_CONFIG","renderMarkdownEffect"],"sources":["../src/index.ts"],"sourcesContent":["import { Effect } from \"effect\";\nimport { FileSystem, Path } from \"@effect/platform\";\nimport { NodeContext } from \"@effect/platform-node\";\nimport { loadConfigEffect, type LoadConfigOptions } from \"./config\";\nimport {\n getPostEffect,\n getPostsEffect,\n type GetPostsEffectOptions,\n} from \"./content\";\nimport { renderMarkdownEffect, type RenderResult } from \"./render\";\nimport { DEFAULT_CONFIG, type Post, type VoxxConfig } from \"./types\";\n\ntype Services = FileSystem.FileSystem | Path.Path;\n\nconst run = <A, E>(effect: Effect.Effect<A, E, Services>): Promise<A> =>\n Effect.runPromise(Effect.provide(effect, NodeContext.layer));\n\n/** Options accepted by `getPosts` and `getPost`. */\nexport interface GetPostsOptions\n extends GetPostsEffectOptions, LoadConfigOptions {\n /** Pre-loaded config — skips reading `voxx.json` when provided. */\n config?: VoxxConfig;\n}\n\n/**\n * Reads and validates `voxx.json` from disk.\n *\n * @param opts - Optional `cwd` or explicit config file `path`.\n * @returns Fully resolved `VoxxConfig`.\n */\nexport function loadConfig(opts?: LoadConfigOptions): Promise<VoxxConfig> {\n return run(loadConfigEffect(opts));\n}\n\n/**\n * Returns all published posts for the active collection, sorted by the\n * collection type's natural order (date, semver, or manual order prefix).\n *\n * @param opts - Collection filter, draft visibility, and optional pre-loaded config.\n */\nexport function getPosts(opts: GetPostsOptions = {}): Promise<Post[]> {\n return run(\n Effect.gen(function* () {\n const config = opts.config ?? (yield* loadConfigEffect(opts));\n return yield* getPostsEffect(config, opts);\n }),\n );\n}\n\n/**\n * Returns a single post by slug.\n *\n * @param slug - Slash-separated path, e.g. `\"getting-started/install\"`.\n * @param opts - Collection filter, draft visibility, and optional pre-loaded config.\n * @throws `PostNotFound` if no matching post exists.\n */\nexport function getPost(\n slug: string,\n opts: GetPostsOptions = {},\n): Promise<Post> {\n return run(\n Effect.gen(function* () {\n const config = opts.config ?? (yield* loadConfigEffect(opts));\n return yield* getPostEffect(config, slug, opts);\n }),\n );\n}\n\n/**\n * Converts a Markdown string to HTML with syntax highlighting and TOC extraction.\n *\n * @param markdown - Raw Markdown source.\n * @param config - Voxx config (controls code theme). Defaults to `DEFAULT_CONFIG`.\n */\nexport function renderMarkdown(\n markdown: string,\n config: VoxxConfig = DEFAULT_CONFIG,\n): Promise<RenderResult> {\n return run(renderMarkdownEffect(markdown, config));\n}\n\nexport { buildSeo } from \"./seo\";\nexport { renderRss, renderSitemap, renderRobotsTxt, rssPath } from \"./feeds\";\nexport type { RenderRssOptions, RenderSitemapOptions } from \"./feeds\";\nexport {\n renderLlmsTxt,\n renderLlmsTxtSections,\n renderLlmsFull,\n sectionHeading,\n} from \"./llms\";\nexport type { LlmsSection } from \"./llms\";\nexport { findPost } from \"./content\";\nexport { registerContentWatcher } from \"./dev\";\nexport type { ContentWatcherOptions } from \"./dev\";\nexport { buildNavTree } from \"./nav\";\nexport { DEFAULT_CONFIG } from \"./types\";\nexport {\n slugify,\n joinPath,\n absoluteUrl,\n readingTimeMinutes,\n deriveExcerpt,\n splitDatePrefix,\n splitOrderPrefix,\n humanize,\n formatDate,\n parseVersion,\n compareVersions,\n escapeXml,\n serializeJsonLd,\n} from \"./util\";\n\nexport type {\n VoxxConfig,\n VoxxAuthor,\n ContentType,\n CollectionConfig,\n Post,\n TocItem,\n NavNode,\n SeoData,\n OpenGraphData,\n TwitterData,\n} from \"./types\";\nexport type { RenderResult } from \"./render\";\nexport { resolveCollectionDefaults } from \"./config\";\nexport type { CollectionInput, LoadConfigOptions } from \"./config\";\nexport type {\n ConfigError,\n InvalidFrontmatter,\n PostNotFound,\n ContentDirMissing,\n RenderError,\n VoxxError,\n} from \"./errors\";\n"],"mappings":";;;;;;;;;;;;;;AAcA,MAAM,OAAa,aACjBA,OAAAA,OAAO,WAAWA,OAAAA,OAAO,QAAQC,UAAQC,sBAAAA,YAAY,KAAK,CAAC;;;;;;;AAe7D,SAAgB,WAAW,MAA+C;CACxE,OAAO,IAAIC,eAAAA,iBAAiB,IAAI,CAAC;AACnC;;;;;;;AAQA,SAAgB,SAAS,OAAwB,CAAC,GAAoB;CACpE,OAAO,IACLH,OAAAA,OAAO,IAAI,aAAa;EAEtB,OAAO,OAAOI,gBAAAA,eADC,KAAK,WAAW,OAAOD,eAAAA,iBAAiB,IAAI,IACtB,IAAI;CAC3C,CAAC,CACH;AACF;;;;;;;;AASA,SAAgB,QACd,MACA,OAAwB,CAAC,GACV;CACf,OAAO,IACLH,OAAAA,OAAO,IAAI,aAAa;EAEtB,OAAO,OAAOK,gBAAAA,cADC,KAAK,WAAW,OAAOF,eAAAA,iBAAiB,IAAI,IACvB,MAAM,IAAI;CAChD,CAAC,CACH;AACF;;;;;;;AAQA,SAAgB,eACd,UACA,SAAqBG,cAAAA,gBACE;CACvB,OAAO,IAAIC,eAAAA,qBAAqB,UAAU,MAAM,CAAC;AACnD"}
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { ConfigError, ContentDirMissing, InvalidFrontmatter, PostNotFound, RenderError, VoxxError } from "./errors.cjs";
|
|
2
|
+
import { CollectionConfig, ContentType, DEFAULT_CONFIG, NavNode, OpenGraphData, Post, SeoData, TocItem, TwitterData, VoxxAuthor, VoxxConfig } from "./types.cjs";
|
|
3
|
+
import { CollectionInput, LoadConfigOptions, resolveCollectionDefaults } from "./config.cjs";
|
|
4
|
+
import { GetPostsEffectOptions, findPost } from "./content.cjs";
|
|
5
|
+
import { RenderResult } from "./render.cjs";
|
|
6
|
+
import { buildSeo } from "./seo.cjs";
|
|
7
|
+
import { RenderRssOptions, RenderSitemapOptions, renderRobotsTxt, renderRss, renderSitemap, rssPath } from "./feeds.cjs";
|
|
8
|
+
import { LlmsSection, renderLlmsFull, renderLlmsTxt, renderLlmsTxtSections, sectionHeading } from "./llms.cjs";
|
|
9
|
+
import { ContentWatcherOptions, registerContentWatcher } from "./dev.cjs";
|
|
10
|
+
import { buildNavTree } from "./nav.cjs";
|
|
11
|
+
import { absoluteUrl, compareVersions, deriveExcerpt, escapeXml, formatDate, humanize, joinPath, parseVersion, readingTimeMinutes, serializeJsonLd, slugify, splitDatePrefix, splitOrderPrefix } from "./util.cjs";
|
|
12
|
+
|
|
13
|
+
//#region src/index.d.ts
|
|
14
|
+
/** Options accepted by `getPosts` and `getPost`. */
|
|
15
|
+
interface GetPostsOptions extends GetPostsEffectOptions, LoadConfigOptions {
|
|
16
|
+
/** Pre-loaded config — skips reading `voxx.json` when provided. */
|
|
17
|
+
config?: VoxxConfig;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Reads and validates `voxx.json` from disk.
|
|
21
|
+
*
|
|
22
|
+
* @param opts - Optional `cwd` or explicit config file `path`.
|
|
23
|
+
* @returns Fully resolved `VoxxConfig`.
|
|
24
|
+
*/
|
|
25
|
+
declare function loadConfig(opts?: LoadConfigOptions): Promise<VoxxConfig>;
|
|
26
|
+
/**
|
|
27
|
+
* Returns all published posts for the active collection, sorted by the
|
|
28
|
+
* collection type's natural order (date, semver, or manual order prefix).
|
|
29
|
+
*
|
|
30
|
+
* @param opts - Collection filter, draft visibility, and optional pre-loaded config.
|
|
31
|
+
*/
|
|
32
|
+
declare function getPosts(opts?: GetPostsOptions): Promise<Post[]>;
|
|
33
|
+
/**
|
|
34
|
+
* Returns a single post by slug.
|
|
35
|
+
*
|
|
36
|
+
* @param slug - Slash-separated path, e.g. `"getting-started/install"`.
|
|
37
|
+
* @param opts - Collection filter, draft visibility, and optional pre-loaded config.
|
|
38
|
+
* @throws `PostNotFound` if no matching post exists.
|
|
39
|
+
*/
|
|
40
|
+
declare function getPost(slug: string, opts?: GetPostsOptions): Promise<Post>;
|
|
41
|
+
/**
|
|
42
|
+
* Converts a Markdown string to HTML with syntax highlighting and TOC extraction.
|
|
43
|
+
*
|
|
44
|
+
* @param markdown - Raw Markdown source.
|
|
45
|
+
* @param config - Voxx config (controls code theme). Defaults to `DEFAULT_CONFIG`.
|
|
46
|
+
*/
|
|
47
|
+
declare function renderMarkdown(markdown: string, config?: VoxxConfig): Promise<RenderResult>;
|
|
48
|
+
//#endregion
|
|
49
|
+
export { type CollectionConfig, type CollectionInput, type ConfigError, type ContentDirMissing, type ContentType, type ContentWatcherOptions, DEFAULT_CONFIG, GetPostsOptions, type InvalidFrontmatter, type LlmsSection, type LoadConfigOptions, type NavNode, type OpenGraphData, type Post, type PostNotFound, type RenderError, type RenderResult, type RenderRssOptions, type RenderSitemapOptions, type SeoData, type TocItem, type TwitterData, type VoxxAuthor, type VoxxConfig, type VoxxError, absoluteUrl, buildNavTree, buildSeo, compareVersions, deriveExcerpt, escapeXml, findPost, formatDate, getPost, getPosts, humanize, joinPath, loadConfig, parseVersion, readingTimeMinutes, registerContentWatcher, renderLlmsFull, renderLlmsTxt, renderLlmsTxtSections, renderMarkdown, renderRobotsTxt, renderRss, renderSitemap, resolveCollectionDefaults, rssPath, sectionHeading, serializeJsonLd, slugify, splitDatePrefix, splitOrderPrefix };
|
|
50
|
+
//# sourceMappingURL=index.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.ts"],"mappings":";;;;;;;;;;;;;;UAkBiB,eAAA,SACP,qBAAA,EAAuB,iBAAA;;EAE/B,MAAA,GAAS,UAAA;AAAA;;;;;AAHX;;iBAYgB,UAAA,CAAW,IAAA,GAAO,iBAAA,GAAoB,OAAA,CAAQ,UAAA;;;;;;;iBAU9C,QAAA,CAAS,IAAA,GAAM,eAAA,GAAuB,OAAA,CAAQ,IAAA;;;;AAnBzC;AASrB;;;iBA0BgB,OAAA,CACd,IAAA,UACA,IAAA,GAAM,eAAA,GACL,OAAA,CAAQ,IAAA;;;;;;;iBAeK,cAAA,CACd,QAAA,UACA,MAAA,GAAQ,UAAA,GACP,OAAA,CAAQ,YAAA"}
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { ConfigError, ContentDirMissing, InvalidFrontmatter, PostNotFound, RenderError, VoxxError } from "./errors.mjs";
|
|
2
|
+
import { CollectionConfig, ContentType, DEFAULT_CONFIG, NavNode, OpenGraphData, Post, SeoData, TocItem, TwitterData, VoxxAuthor, VoxxConfig } from "./types.mjs";
|
|
3
|
+
import { CollectionInput, LoadConfigOptions, resolveCollectionDefaults } from "./config.mjs";
|
|
4
|
+
import { GetPostsEffectOptions, findPost } from "./content.mjs";
|
|
5
|
+
import { RenderResult } from "./render.mjs";
|
|
6
|
+
import { buildSeo } from "./seo.mjs";
|
|
7
|
+
import { RenderRssOptions, RenderSitemapOptions, renderRobotsTxt, renderRss, renderSitemap, rssPath } from "./feeds.mjs";
|
|
8
|
+
import { LlmsSection, renderLlmsFull, renderLlmsTxt, renderLlmsTxtSections, sectionHeading } from "./llms.mjs";
|
|
9
|
+
import { ContentWatcherOptions, registerContentWatcher } from "./dev.mjs";
|
|
10
|
+
import { buildNavTree } from "./nav.mjs";
|
|
11
|
+
import { absoluteUrl, compareVersions, deriveExcerpt, escapeXml, formatDate, humanize, joinPath, parseVersion, readingTimeMinutes, serializeJsonLd, slugify, splitDatePrefix, splitOrderPrefix } from "./util.mjs";
|
|
12
|
+
|
|
13
|
+
//#region src/index.d.ts
|
|
14
|
+
/** Options accepted by `getPosts` and `getPost`. */
|
|
15
|
+
interface GetPostsOptions extends GetPostsEffectOptions, LoadConfigOptions {
|
|
16
|
+
/** Pre-loaded config — skips reading `voxx.json` when provided. */
|
|
17
|
+
config?: VoxxConfig;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Reads and validates `voxx.json` from disk.
|
|
21
|
+
*
|
|
22
|
+
* @param opts - Optional `cwd` or explicit config file `path`.
|
|
23
|
+
* @returns Fully resolved `VoxxConfig`.
|
|
24
|
+
*/
|
|
25
|
+
declare function loadConfig(opts?: LoadConfigOptions): Promise<VoxxConfig>;
|
|
26
|
+
/**
|
|
27
|
+
* Returns all published posts for the active collection, sorted by the
|
|
28
|
+
* collection type's natural order (date, semver, or manual order prefix).
|
|
29
|
+
*
|
|
30
|
+
* @param opts - Collection filter, draft visibility, and optional pre-loaded config.
|
|
31
|
+
*/
|
|
32
|
+
declare function getPosts(opts?: GetPostsOptions): Promise<Post[]>;
|
|
33
|
+
/**
|
|
34
|
+
* Returns a single post by slug.
|
|
35
|
+
*
|
|
36
|
+
* @param slug - Slash-separated path, e.g. `"getting-started/install"`.
|
|
37
|
+
* @param opts - Collection filter, draft visibility, and optional pre-loaded config.
|
|
38
|
+
* @throws `PostNotFound` if no matching post exists.
|
|
39
|
+
*/
|
|
40
|
+
declare function getPost(slug: string, opts?: GetPostsOptions): Promise<Post>;
|
|
41
|
+
/**
|
|
42
|
+
* Converts a Markdown string to HTML with syntax highlighting and TOC extraction.
|
|
43
|
+
*
|
|
44
|
+
* @param markdown - Raw Markdown source.
|
|
45
|
+
* @param config - Voxx config (controls code theme). Defaults to `DEFAULT_CONFIG`.
|
|
46
|
+
*/
|
|
47
|
+
declare function renderMarkdown(markdown: string, config?: VoxxConfig): Promise<RenderResult>;
|
|
48
|
+
//#endregion
|
|
49
|
+
export { type CollectionConfig, type CollectionInput, type ConfigError, type ContentDirMissing, type ContentType, type ContentWatcherOptions, DEFAULT_CONFIG, GetPostsOptions, type InvalidFrontmatter, type LlmsSection, type LoadConfigOptions, type NavNode, type OpenGraphData, type Post, type PostNotFound, type RenderError, type RenderResult, type RenderRssOptions, type RenderSitemapOptions, type SeoData, type TocItem, type TwitterData, type VoxxAuthor, type VoxxConfig, type VoxxError, absoluteUrl, buildNavTree, buildSeo, compareVersions, deriveExcerpt, escapeXml, findPost, formatDate, getPost, getPosts, humanize, joinPath, loadConfig, parseVersion, readingTimeMinutes, registerContentWatcher, renderLlmsFull, renderLlmsTxt, renderLlmsTxtSections, renderMarkdown, renderRobotsTxt, renderRss, renderSitemap, resolveCollectionDefaults, rssPath, sectionHeading, serializeJsonLd, slugify, splitDatePrefix, splitOrderPrefix };
|
|
50
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.ts"],"mappings":";;;;;;;;;;;;;;UAkBiB,eAAA,SACP,qBAAA,EAAuB,iBAAA;;EAE/B,MAAA,GAAS,UAAA;AAAA;;;;;AAHX;;iBAYgB,UAAA,CAAW,IAAA,GAAO,iBAAA,GAAoB,OAAA,CAAQ,UAAA;;;;;;;iBAU9C,QAAA,CAAS,IAAA,GAAM,eAAA,GAAuB,OAAA,CAAQ,IAAA;;;;AAnBzC;AASrB;;;iBA0BgB,OAAA,CACd,IAAA,UACA,IAAA,GAAM,eAAA,GACL,OAAA,CAAQ,IAAA;;;;;;;iBAeK,cAAA,CACd,QAAA,UACA,MAAA,GAAQ,UAAA,GACP,OAAA,CAAQ,YAAA"}
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { DEFAULT_CONFIG } from "./types.mjs";
|
|
2
|
+
import { loadConfigEffect, resolveCollectionDefaults } from "./config.mjs";
|
|
3
|
+
import { renderMarkdownEffect } from "./render.mjs";
|
|
4
|
+
import { absoluteUrl, compareVersions, deriveExcerpt, escapeXml, formatDate, humanize, joinPath, parseVersion, readingTimeMinutes, serializeJsonLd, slugify, splitDatePrefix, splitOrderPrefix } from "./util.mjs";
|
|
5
|
+
import { findPost, getPostEffect, getPostsEffect } from "./content.mjs";
|
|
6
|
+
import { buildSeo } from "./seo.mjs";
|
|
7
|
+
import { renderRobotsTxt, renderRss, renderSitemap, rssPath } from "./feeds.mjs";
|
|
8
|
+
import { renderLlmsFull, renderLlmsTxt, renderLlmsTxtSections, sectionHeading } from "./llms.mjs";
|
|
9
|
+
import { registerContentWatcher } from "./dev.mjs";
|
|
10
|
+
import { buildNavTree } from "./nav.mjs";
|
|
11
|
+
import { Effect } from "effect";
|
|
12
|
+
import { NodeContext } from "@effect/platform-node";
|
|
13
|
+
//#region src/index.ts
|
|
14
|
+
const run = (effect) => Effect.runPromise(Effect.provide(effect, NodeContext.layer));
|
|
15
|
+
/**
|
|
16
|
+
* Reads and validates `voxx.json` from disk.
|
|
17
|
+
*
|
|
18
|
+
* @param opts - Optional `cwd` or explicit config file `path`.
|
|
19
|
+
* @returns Fully resolved `VoxxConfig`.
|
|
20
|
+
*/
|
|
21
|
+
function loadConfig(opts) {
|
|
22
|
+
return run(loadConfigEffect(opts));
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Returns all published posts for the active collection, sorted by the
|
|
26
|
+
* collection type's natural order (date, semver, or manual order prefix).
|
|
27
|
+
*
|
|
28
|
+
* @param opts - Collection filter, draft visibility, and optional pre-loaded config.
|
|
29
|
+
*/
|
|
30
|
+
function getPosts(opts = {}) {
|
|
31
|
+
return run(Effect.gen(function* () {
|
|
32
|
+
return yield* getPostsEffect(opts.config ?? (yield* loadConfigEffect(opts)), opts);
|
|
33
|
+
}));
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Returns a single post by slug.
|
|
37
|
+
*
|
|
38
|
+
* @param slug - Slash-separated path, e.g. `"getting-started/install"`.
|
|
39
|
+
* @param opts - Collection filter, draft visibility, and optional pre-loaded config.
|
|
40
|
+
* @throws `PostNotFound` if no matching post exists.
|
|
41
|
+
*/
|
|
42
|
+
function getPost(slug, opts = {}) {
|
|
43
|
+
return run(Effect.gen(function* () {
|
|
44
|
+
return yield* getPostEffect(opts.config ?? (yield* loadConfigEffect(opts)), slug, opts);
|
|
45
|
+
}));
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Converts a Markdown string to HTML with syntax highlighting and TOC extraction.
|
|
49
|
+
*
|
|
50
|
+
* @param markdown - Raw Markdown source.
|
|
51
|
+
* @param config - Voxx config (controls code theme). Defaults to `DEFAULT_CONFIG`.
|
|
52
|
+
*/
|
|
53
|
+
function renderMarkdown(markdown, config = DEFAULT_CONFIG) {
|
|
54
|
+
return run(renderMarkdownEffect(markdown, config));
|
|
55
|
+
}
|
|
56
|
+
//#endregion
|
|
57
|
+
export { DEFAULT_CONFIG, absoluteUrl, buildNavTree, buildSeo, compareVersions, deriveExcerpt, escapeXml, findPost, formatDate, getPost, getPosts, humanize, joinPath, loadConfig, parseVersion, readingTimeMinutes, registerContentWatcher, renderLlmsFull, renderLlmsTxt, renderLlmsTxtSections, renderMarkdown, renderRobotsTxt, renderRss, renderSitemap, resolveCollectionDefaults, rssPath, sectionHeading, serializeJsonLd, slugify, splitDatePrefix, splitOrderPrefix };
|
|
58
|
+
|
|
59
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../src/index.ts"],"sourcesContent":["import { Effect } from \"effect\";\nimport { FileSystem, Path } from \"@effect/platform\";\nimport { NodeContext } from \"@effect/platform-node\";\nimport { loadConfigEffect, type LoadConfigOptions } from \"./config\";\nimport {\n getPostEffect,\n getPostsEffect,\n type GetPostsEffectOptions,\n} from \"./content\";\nimport { renderMarkdownEffect, type RenderResult } from \"./render\";\nimport { DEFAULT_CONFIG, type Post, type VoxxConfig } from \"./types\";\n\ntype Services = FileSystem.FileSystem | Path.Path;\n\nconst run = <A, E>(effect: Effect.Effect<A, E, Services>): Promise<A> =>\n Effect.runPromise(Effect.provide(effect, NodeContext.layer));\n\n/** Options accepted by `getPosts` and `getPost`. */\nexport interface GetPostsOptions\n extends GetPostsEffectOptions, LoadConfigOptions {\n /** Pre-loaded config — skips reading `voxx.json` when provided. */\n config?: VoxxConfig;\n}\n\n/**\n * Reads and validates `voxx.json` from disk.\n *\n * @param opts - Optional `cwd` or explicit config file `path`.\n * @returns Fully resolved `VoxxConfig`.\n */\nexport function loadConfig(opts?: LoadConfigOptions): Promise<VoxxConfig> {\n return run(loadConfigEffect(opts));\n}\n\n/**\n * Returns all published posts for the active collection, sorted by the\n * collection type's natural order (date, semver, or manual order prefix).\n *\n * @param opts - Collection filter, draft visibility, and optional pre-loaded config.\n */\nexport function getPosts(opts: GetPostsOptions = {}): Promise<Post[]> {\n return run(\n Effect.gen(function* () {\n const config = opts.config ?? (yield* loadConfigEffect(opts));\n return yield* getPostsEffect(config, opts);\n }),\n );\n}\n\n/**\n * Returns a single post by slug.\n *\n * @param slug - Slash-separated path, e.g. `\"getting-started/install\"`.\n * @param opts - Collection filter, draft visibility, and optional pre-loaded config.\n * @throws `PostNotFound` if no matching post exists.\n */\nexport function getPost(\n slug: string,\n opts: GetPostsOptions = {},\n): Promise<Post> {\n return run(\n Effect.gen(function* () {\n const config = opts.config ?? (yield* loadConfigEffect(opts));\n return yield* getPostEffect(config, slug, opts);\n }),\n );\n}\n\n/**\n * Converts a Markdown string to HTML with syntax highlighting and TOC extraction.\n *\n * @param markdown - Raw Markdown source.\n * @param config - Voxx config (controls code theme). Defaults to `DEFAULT_CONFIG`.\n */\nexport function renderMarkdown(\n markdown: string,\n config: VoxxConfig = DEFAULT_CONFIG,\n): Promise<RenderResult> {\n return run(renderMarkdownEffect(markdown, config));\n}\n\nexport { buildSeo } from \"./seo\";\nexport { renderRss, renderSitemap, renderRobotsTxt, rssPath } from \"./feeds\";\nexport type { RenderRssOptions, RenderSitemapOptions } from \"./feeds\";\nexport {\n renderLlmsTxt,\n renderLlmsTxtSections,\n renderLlmsFull,\n sectionHeading,\n} from \"./llms\";\nexport type { LlmsSection } from \"./llms\";\nexport { findPost } from \"./content\";\nexport { registerContentWatcher } from \"./dev\";\nexport type { ContentWatcherOptions } from \"./dev\";\nexport { buildNavTree } from \"./nav\";\nexport { DEFAULT_CONFIG } from \"./types\";\nexport {\n slugify,\n joinPath,\n absoluteUrl,\n readingTimeMinutes,\n deriveExcerpt,\n splitDatePrefix,\n splitOrderPrefix,\n humanize,\n formatDate,\n parseVersion,\n compareVersions,\n escapeXml,\n serializeJsonLd,\n} from \"./util\";\n\nexport type {\n VoxxConfig,\n VoxxAuthor,\n ContentType,\n CollectionConfig,\n Post,\n TocItem,\n NavNode,\n SeoData,\n OpenGraphData,\n TwitterData,\n} from \"./types\";\nexport type { RenderResult } from \"./render\";\nexport { resolveCollectionDefaults } from \"./config\";\nexport type { CollectionInput, LoadConfigOptions } from \"./config\";\nexport type {\n ConfigError,\n InvalidFrontmatter,\n PostNotFound,\n ContentDirMissing,\n RenderError,\n VoxxError,\n} from \"./errors\";\n"],"mappings":";;;;;;;;;;;;;AAcA,MAAM,OAAa,WACjB,OAAO,WAAW,OAAO,QAAQ,QAAQ,YAAY,KAAK,CAAC;;;;;;;AAe7D,SAAgB,WAAW,MAA+C;CACxE,OAAO,IAAI,iBAAiB,IAAI,CAAC;AACnC;;;;;;;AAQA,SAAgB,SAAS,OAAwB,CAAC,GAAoB;CACpE,OAAO,IACL,OAAO,IAAI,aAAa;EAEtB,OAAO,OAAO,eADC,KAAK,WAAW,OAAO,iBAAiB,IAAI,IACtB,IAAI;CAC3C,CAAC,CACH;AACF;;;;;;;;AASA,SAAgB,QACd,MACA,OAAwB,CAAC,GACV;CACf,OAAO,IACL,OAAO,IAAI,aAAa;EAEtB,OAAO,OAAO,cADC,KAAK,WAAW,OAAO,iBAAiB,IAAI,IACvB,MAAM,IAAI;CAChD,CAAC,CACH;AACF;;;;;;;AAQA,SAAgB,eACd,UACA,SAAqB,gBACE;CACvB,OAAO,IAAI,qBAAqB,UAAU,MAAM,CAAC;AACnD"}
|
package/dist/llms.cjs
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
const require_util = require("./util.cjs");
|
|
2
|
+
//#region src/llms.ts
|
|
3
|
+
const SECTION_HEADING = {
|
|
4
|
+
blog: "Posts",
|
|
5
|
+
docs: "Pages",
|
|
6
|
+
changelog: "Releases"
|
|
7
|
+
};
|
|
8
|
+
const oneLine = (s) => s.replace(/\s*\n\s*/g, " ").trim();
|
|
9
|
+
const escLinkText = (s) => oneLine(s).replace(/([[\]])/g, "\\$1");
|
|
10
|
+
const escHeading = (s) => oneLine(s);
|
|
11
|
+
/**
|
|
12
|
+
* Returns the default section heading for a content type.
|
|
13
|
+
*
|
|
14
|
+
* @param type - Content type from the Voxx config.
|
|
15
|
+
* @returns Human-readable heading, e.g. `"Posts"`, `"Pages"`, `"Releases"`.
|
|
16
|
+
*/
|
|
17
|
+
function sectionHeading(type) {
|
|
18
|
+
return SECTION_HEADING[type];
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Renders a `llms.txt` file from one or more labeled post sections.
|
|
22
|
+
*
|
|
23
|
+
* @param sections - Ordered list of headings with their associated posts.
|
|
24
|
+
* @param config - Resolved Voxx config (used for site title and description).
|
|
25
|
+
* @returns `llms.txt` Markdown string.
|
|
26
|
+
*/
|
|
27
|
+
function renderLlmsTxtSections(sections, config) {
|
|
28
|
+
const lines = [`# ${config.site.title}`, ""];
|
|
29
|
+
if (config.site.description) lines.push(`> ${config.site.description}`, "");
|
|
30
|
+
for (const section of sections) {
|
|
31
|
+
lines.push(`## ${section.heading}`, "");
|
|
32
|
+
for (const p of section.posts) {
|
|
33
|
+
const link = require_util.absoluteUrl(config.site.url, p.url);
|
|
34
|
+
const summary = p.description ?? p.excerpt;
|
|
35
|
+
const title = escLinkText(p.title);
|
|
36
|
+
const safeSummary = summary ? oneLine(summary) : "";
|
|
37
|
+
lines.push(`- [${title}](${link})${safeSummary ? `: ${safeSummary}` : ""}`);
|
|
38
|
+
}
|
|
39
|
+
lines.push("");
|
|
40
|
+
}
|
|
41
|
+
return lines.join("\n");
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Renders a `llms.txt` index linking all posts with one-line summaries.
|
|
45
|
+
*
|
|
46
|
+
* @param posts - All posts to include.
|
|
47
|
+
* @param config - Resolved Voxx config.
|
|
48
|
+
* @returns `llms.txt` Markdown string.
|
|
49
|
+
*/
|
|
50
|
+
function renderLlmsTxt(posts, config) {
|
|
51
|
+
return renderLlmsTxtSections([{
|
|
52
|
+
heading: SECTION_HEADING[config.content.type],
|
|
53
|
+
posts
|
|
54
|
+
}], config);
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Renders an `llms-full.txt` file containing the complete Markdown content
|
|
58
|
+
* of every post, separated by `---` dividers.
|
|
59
|
+
*
|
|
60
|
+
* @param posts - All posts to include.
|
|
61
|
+
* @param config - Resolved Voxx config.
|
|
62
|
+
* @returns Full-content `llms-full.txt` string.
|
|
63
|
+
*/
|
|
64
|
+
function renderLlmsFull(posts, config) {
|
|
65
|
+
const out = [`# ${config.site.title}`, ""];
|
|
66
|
+
if (config.site.description) out.push(config.site.description, "");
|
|
67
|
+
for (const p of posts) {
|
|
68
|
+
const link = require_util.absoluteUrl(config.site.url, p.url);
|
|
69
|
+
out.push("---", "", `# ${escHeading(p.title)}`, "", `Source: ${link}`, `Date: ${p.date}`);
|
|
70
|
+
if (p.tags.length) out.push(`Tags: ${p.tags.join(", ")}`);
|
|
71
|
+
out.push("", p.content.trim(), "");
|
|
72
|
+
}
|
|
73
|
+
return out.join("\n");
|
|
74
|
+
}
|
|
75
|
+
//#endregion
|
|
76
|
+
exports.renderLlmsFull = renderLlmsFull;
|
|
77
|
+
exports.renderLlmsTxt = renderLlmsTxt;
|
|
78
|
+
exports.renderLlmsTxtSections = renderLlmsTxtSections;
|
|
79
|
+
exports.sectionHeading = sectionHeading;
|
|
80
|
+
|
|
81
|
+
//# sourceMappingURL=llms.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"llms.cjs","names":["absoluteUrl"],"sources":["../src/llms.ts"],"sourcesContent":["import { absoluteUrl } from \"./util\";\nimport type { ContentType, Post, VoxxConfig } from \"./types\";\n\nconst SECTION_HEADING: Record<ContentType, string> = {\n blog: \"Posts\",\n docs: \"Pages\",\n changelog: \"Releases\",\n};\n\nconst oneLine = (s: string) => s.replace(/\\s*\\n\\s*/g, \" \").trim();\nconst escLinkText = (s: string) => oneLine(s).replace(/([[\\]])/g, \"\\\\$1\");\nconst escHeading = (s: string) => oneLine(s);\n\n/** A titled group of posts for use in `renderLlmsTxtSections`. */\nexport interface LlmsSection {\n heading: string;\n posts: Post[];\n}\n\n/**\n * Returns the default section heading for a content type.\n *\n * @param type - Content type from the Voxx config.\n * @returns Human-readable heading, e.g. `\"Posts\"`, `\"Pages\"`, `\"Releases\"`.\n */\nexport function sectionHeading(type: ContentType): string {\n return SECTION_HEADING[type];\n}\n\n/**\n * Renders a `llms.txt` file from one or more labeled post sections.\n *\n * @param sections - Ordered list of headings with their associated posts.\n * @param config - Resolved Voxx config (used for site title and description).\n * @returns `llms.txt` Markdown string.\n */\nexport function renderLlmsTxtSections(\n sections: LlmsSection[],\n config: VoxxConfig,\n): string {\n const lines: string[] = [`# ${config.site.title}`, \"\"];\n if (config.site.description) lines.push(`> ${config.site.description}`, \"\");\n for (const section of sections) {\n lines.push(`## ${section.heading}`, \"\");\n for (const p of section.posts) {\n const link = absoluteUrl(config.site.url, p.url);\n const summary = p.description ?? p.excerpt;\n const title = escLinkText(p.title);\n const safeSummary = summary ? oneLine(summary) : \"\";\n lines.push(\n `- [${title}](${link})${safeSummary ? `: ${safeSummary}` : \"\"}`,\n );\n }\n lines.push(\"\");\n }\n return lines.join(\"\\n\");\n}\n\n/**\n * Renders a `llms.txt` index linking all posts with one-line summaries.\n *\n * @param posts - All posts to include.\n * @param config - Resolved Voxx config.\n * @returns `llms.txt` Markdown string.\n */\nexport function renderLlmsTxt(posts: Post[], config: VoxxConfig): string {\n return renderLlmsTxtSections(\n [{ heading: SECTION_HEADING[config.content.type], posts }],\n config,\n );\n}\n\n/**\n * Renders an `llms-full.txt` file containing the complete Markdown content\n * of every post, separated by `---` dividers.\n *\n * @param posts - All posts to include.\n * @param config - Resolved Voxx config.\n * @returns Full-content `llms-full.txt` string.\n */\nexport function renderLlmsFull(posts: Post[], config: VoxxConfig): string {\n const out: string[] = [`# ${config.site.title}`, \"\"];\n if (config.site.description) out.push(config.site.description, \"\");\n for (const p of posts) {\n const link = absoluteUrl(config.site.url, p.url);\n out.push(\n \"---\",\n \"\",\n `# ${escHeading(p.title)}`,\n \"\",\n `Source: ${link}`,\n `Date: ${p.date}`,\n );\n if (p.tags.length) out.push(`Tags: ${p.tags.join(\", \")}`);\n out.push(\"\", p.content.trim(), \"\");\n }\n return out.join(\"\\n\");\n}\n"],"mappings":";;AAGA,MAAM,kBAA+C;CACnD,MAAM;CACN,MAAM;CACN,WAAW;AACb;AAEA,MAAM,WAAW,MAAc,EAAE,QAAQ,aAAa,GAAG,CAAC,CAAC,KAAK;AAChE,MAAM,eAAe,MAAc,QAAQ,CAAC,CAAC,CAAC,QAAQ,YAAY,MAAM;AACxE,MAAM,cAAc,MAAc,QAAQ,CAAC;;;;;;;AAc3C,SAAgB,eAAe,MAA2B;CACxD,OAAO,gBAAgB;AACzB;;;;;;;;AASA,SAAgB,sBACd,UACA,QACQ;CACR,MAAM,QAAkB,CAAC,KAAK,OAAO,KAAK,SAAS,EAAE;CACrD,IAAI,OAAO,KAAK,aAAa,MAAM,KAAK,KAAK,OAAO,KAAK,eAAe,EAAE;CAC1E,KAAK,MAAM,WAAW,UAAU;EAC9B,MAAM,KAAK,MAAM,QAAQ,WAAW,EAAE;EACtC,KAAK,MAAM,KAAK,QAAQ,OAAO;GAC7B,MAAM,OAAOA,aAAAA,YAAY,OAAO,KAAK,KAAK,EAAE,GAAG;GAC/C,MAAM,UAAU,EAAE,eAAe,EAAE;GACnC,MAAM,QAAQ,YAAY,EAAE,KAAK;GACjC,MAAM,cAAc,UAAU,QAAQ,OAAO,IAAI;GACjD,MAAM,KACJ,MAAM,MAAM,IAAI,KAAK,GAAG,cAAc,KAAK,gBAAgB,IAC7D;EACF;EACA,MAAM,KAAK,EAAE;CACf;CACA,OAAO,MAAM,KAAK,IAAI;AACxB;;;;;;;;AASA,SAAgB,cAAc,OAAe,QAA4B;CACvE,OAAO,sBACL,CAAC;EAAE,SAAS,gBAAgB,OAAO,QAAQ;EAAO;CAAM,CAAC,GACzD,MACF;AACF;;;;;;;;;AAUA,SAAgB,eAAe,OAAe,QAA4B;CACxE,MAAM,MAAgB,CAAC,KAAK,OAAO,KAAK,SAAS,EAAE;CACnD,IAAI,OAAO,KAAK,aAAa,IAAI,KAAK,OAAO,KAAK,aAAa,EAAE;CACjE,KAAK,MAAM,KAAK,OAAO;EACrB,MAAM,OAAOA,aAAAA,YAAY,OAAO,KAAK,KAAK,EAAE,GAAG;EAC/C,IAAI,KACF,OACA,IACA,KAAK,WAAW,EAAE,KAAK,KACvB,IACA,WAAW,QACX,SAAS,EAAE,MACb;EACA,IAAI,EAAE,KAAK,QAAQ,IAAI,KAAK,SAAS,EAAE,KAAK,KAAK,IAAI,GAAG;EACxD,IAAI,KAAK,IAAI,EAAE,QAAQ,KAAK,GAAG,EAAE;CACnC;CACA,OAAO,IAAI,KAAK,IAAI;AACtB"}
|
package/dist/llms.d.cts
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { ContentType, Post, VoxxConfig } from "./types.cjs";
|
|
2
|
+
|
|
3
|
+
//#region src/llms.d.ts
|
|
4
|
+
/** A titled group of posts for use in `renderLlmsTxtSections`. */
|
|
5
|
+
interface LlmsSection {
|
|
6
|
+
heading: string;
|
|
7
|
+
posts: Post[];
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Returns the default section heading for a content type.
|
|
11
|
+
*
|
|
12
|
+
* @param type - Content type from the Voxx config.
|
|
13
|
+
* @returns Human-readable heading, e.g. `"Posts"`, `"Pages"`, `"Releases"`.
|
|
14
|
+
*/
|
|
15
|
+
declare function sectionHeading(type: ContentType): string;
|
|
16
|
+
/**
|
|
17
|
+
* Renders a `llms.txt` file from one or more labeled post sections.
|
|
18
|
+
*
|
|
19
|
+
* @param sections - Ordered list of headings with their associated posts.
|
|
20
|
+
* @param config - Resolved Voxx config (used for site title and description).
|
|
21
|
+
* @returns `llms.txt` Markdown string.
|
|
22
|
+
*/
|
|
23
|
+
declare function renderLlmsTxtSections(sections: LlmsSection[], config: VoxxConfig): string;
|
|
24
|
+
/**
|
|
25
|
+
* Renders a `llms.txt` index linking all posts with one-line summaries.
|
|
26
|
+
*
|
|
27
|
+
* @param posts - All posts to include.
|
|
28
|
+
* @param config - Resolved Voxx config.
|
|
29
|
+
* @returns `llms.txt` Markdown string.
|
|
30
|
+
*/
|
|
31
|
+
declare function renderLlmsTxt(posts: Post[], config: VoxxConfig): string;
|
|
32
|
+
/**
|
|
33
|
+
* Renders an `llms-full.txt` file containing the complete Markdown content
|
|
34
|
+
* of every post, separated by `---` dividers.
|
|
35
|
+
*
|
|
36
|
+
* @param posts - All posts to include.
|
|
37
|
+
* @param config - Resolved Voxx config.
|
|
38
|
+
* @returns Full-content `llms-full.txt` string.
|
|
39
|
+
*/
|
|
40
|
+
declare function renderLlmsFull(posts: Post[], config: VoxxConfig): string;
|
|
41
|
+
//#endregion
|
|
42
|
+
export { LlmsSection, renderLlmsFull, renderLlmsTxt, renderLlmsTxtSections, sectionHeading };
|
|
43
|
+
//# sourceMappingURL=llms.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"llms.d.cts","names":[],"sources":["../src/llms.ts"],"mappings":";;;;UAciB,WAAA;EACf,OAAA;EACA,KAAA,EAAO,IAAI;AAAA;;;;;;AAAA;iBASG,cAAA,CAAe,IAAiB,EAAX,WAAW;;;;AAAA;AAWhD;;;iBAAgB,qBAAA,CACd,QAAA,EAAU,WAAA,IACV,MAAA,EAAQ,UAAU;;;;;;AAAA;AA2BpB;iBAAgB,aAAA,CAAc,KAAA,EAAO,IAAA,IAAQ,MAAA,EAAQ,UAAU;;;;;;;;AAAA;iBAe/C,cAAA,CAAe,KAAA,EAAO,IAAA,IAAQ,MAAA,EAAQ,UAAU"}
|
package/dist/llms.d.mts
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { ContentType, Post, VoxxConfig } from "./types.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/llms.d.ts
|
|
4
|
+
/** A titled group of posts for use in `renderLlmsTxtSections`. */
|
|
5
|
+
interface LlmsSection {
|
|
6
|
+
heading: string;
|
|
7
|
+
posts: Post[];
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Returns the default section heading for a content type.
|
|
11
|
+
*
|
|
12
|
+
* @param type - Content type from the Voxx config.
|
|
13
|
+
* @returns Human-readable heading, e.g. `"Posts"`, `"Pages"`, `"Releases"`.
|
|
14
|
+
*/
|
|
15
|
+
declare function sectionHeading(type: ContentType): string;
|
|
16
|
+
/**
|
|
17
|
+
* Renders a `llms.txt` file from one or more labeled post sections.
|
|
18
|
+
*
|
|
19
|
+
* @param sections - Ordered list of headings with their associated posts.
|
|
20
|
+
* @param config - Resolved Voxx config (used for site title and description).
|
|
21
|
+
* @returns `llms.txt` Markdown string.
|
|
22
|
+
*/
|
|
23
|
+
declare function renderLlmsTxtSections(sections: LlmsSection[], config: VoxxConfig): string;
|
|
24
|
+
/**
|
|
25
|
+
* Renders a `llms.txt` index linking all posts with one-line summaries.
|
|
26
|
+
*
|
|
27
|
+
* @param posts - All posts to include.
|
|
28
|
+
* @param config - Resolved Voxx config.
|
|
29
|
+
* @returns `llms.txt` Markdown string.
|
|
30
|
+
*/
|
|
31
|
+
declare function renderLlmsTxt(posts: Post[], config: VoxxConfig): string;
|
|
32
|
+
/**
|
|
33
|
+
* Renders an `llms-full.txt` file containing the complete Markdown content
|
|
34
|
+
* of every post, separated by `---` dividers.
|
|
35
|
+
*
|
|
36
|
+
* @param posts - All posts to include.
|
|
37
|
+
* @param config - Resolved Voxx config.
|
|
38
|
+
* @returns Full-content `llms-full.txt` string.
|
|
39
|
+
*/
|
|
40
|
+
declare function renderLlmsFull(posts: Post[], config: VoxxConfig): string;
|
|
41
|
+
//#endregion
|
|
42
|
+
export { LlmsSection, renderLlmsFull, renderLlmsTxt, renderLlmsTxtSections, sectionHeading };
|
|
43
|
+
//# sourceMappingURL=llms.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"llms.d.mts","names":[],"sources":["../src/llms.ts"],"mappings":";;;;UAciB,WAAA;EACf,OAAA;EACA,KAAA,EAAO,IAAI;AAAA;;;;;;AAAA;iBASG,cAAA,CAAe,IAAiB,EAAX,WAAW;;;;AAAA;AAWhD;;;iBAAgB,qBAAA,CACd,QAAA,EAAU,WAAA,IACV,MAAA,EAAQ,UAAU;;;;;;AAAA;AA2BpB;iBAAgB,aAAA,CAAc,KAAA,EAAO,IAAA,IAAQ,MAAA,EAAQ,UAAU;;;;;;;;AAAA;iBAe/C,cAAA,CAAe,KAAA,EAAO,IAAA,IAAQ,MAAA,EAAQ,UAAU"}
|