frontmatter-kit 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,68 @@
1
+ export type FrontmatterLanguage = "yaml" | "json" | "toml";
2
+ export type FrontmatterSeverity = "info" | "warning" | "error";
3
+ export type FrontmatterValue = string | number | boolean | null | FrontmatterValue[] | {
4
+ [key: string]: FrontmatterValue;
5
+ };
6
+ export type FrontmatterAttributes = Record<string, FrontmatterValue>;
7
+ export interface FrontmatterPosition {
8
+ offset: number;
9
+ line: number;
10
+ column: number;
11
+ }
12
+ export interface FrontmatterRange {
13
+ start: FrontmatterPosition;
14
+ end: FrontmatterPosition;
15
+ }
16
+ export interface FrontmatterDiagnostic {
17
+ code: string;
18
+ severity: FrontmatterSeverity;
19
+ message: string;
20
+ range?: FrontmatterRange | undefined;
21
+ }
22
+ export interface FrontmatterRanges {
23
+ opening?: FrontmatterRange;
24
+ matter?: FrontmatterRange;
25
+ closing?: FrontmatterRange;
26
+ body: FrontmatterRange;
27
+ excerpt?: FrontmatterRange;
28
+ }
29
+ export interface FrontmatterDelimiters {
30
+ opening: string;
31
+ closing: string;
32
+ }
33
+ export interface FrontmatterParseOptions {
34
+ /**
35
+ * Force a front matter language instead of inferring it from the opening
36
+ * marker. `+++` still defaults to TOML when this option is omitted.
37
+ */
38
+ language?: FrontmatterLanguage;
39
+ /**
40
+ * Marker used to derive the optional excerpt.
41
+ *
42
+ * @default "<!-- more -->"
43
+ */
44
+ excerptSeparator?: string | false;
45
+ }
46
+ export interface FrontmatterStringifyOptions {
47
+ language?: FrontmatterLanguage;
48
+ delimiter?: "---" | "+++";
49
+ }
50
+ export interface FrontmatterResult<TAttributes extends FrontmatterAttributes = FrontmatterAttributes> {
51
+ hasFrontmatter: boolean;
52
+ attributes: TAttributes;
53
+ body: string;
54
+ matter: string;
55
+ language?: FrontmatterLanguage;
56
+ delimiters?: FrontmatterDelimiters;
57
+ excerpt?: string | undefined;
58
+ ranges: FrontmatterRanges;
59
+ diagnostics: FrontmatterDiagnostic[];
60
+ }
61
+ export type FrontmatterTryResult<TAttributes extends FrontmatterAttributes = FrontmatterAttributes> = {
62
+ ok: true;
63
+ result: FrontmatterResult<TAttributes>;
64
+ } | {
65
+ ok: false;
66
+ error: Error;
67
+ };
68
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,mBAAmB,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC;AAE3D,MAAM,MAAM,mBAAmB,GAAG,MAAM,GAAG,SAAS,GAAG,OAAO,CAAC;AAE/D,MAAM,MAAM,gBAAgB,GACxB,MAAM,GACN,MAAM,GACN,OAAO,GACP,IAAI,GACJ,gBAAgB,EAAE,GAClB;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,gBAAgB,CAAA;CAAE,CAAC;AAExC,MAAM,MAAM,qBAAqB,GAAG,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;AAErE,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,mBAAmB,CAAC;IAC3B,GAAG,EAAE,mBAAmB,CAAC;CAC1B;AAED,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,mBAAmB,CAAC;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,gBAAgB,GAAG,SAAS,CAAC;CACtC;AAED,MAAM,WAAW,iBAAiB;IAChC,OAAO,CAAC,EAAE,gBAAgB,CAAC;IAC3B,MAAM,CAAC,EAAE,gBAAgB,CAAC;IAC1B,OAAO,CAAC,EAAE,gBAAgB,CAAC;IAC3B,IAAI,EAAE,gBAAgB,CAAC;IACvB,OAAO,CAAC,EAAE,gBAAgB,CAAC;CAC5B;AAED,MAAM,WAAW,qBAAqB;IACpC,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,uBAAuB;IACtC;;;OAGG;IACH,QAAQ,CAAC,EAAE,mBAAmB,CAAC;IAC/B;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC;CACnC;AAED,MAAM,WAAW,2BAA2B;IAC1C,QAAQ,CAAC,EAAE,mBAAmB,CAAC;IAC/B,SAAS,CAAC,EAAE,KAAK,GAAG,KAAK,CAAC;CAC3B;AAED,MAAM,WAAW,iBAAiB,CAAC,WAAW,SAAS,qBAAqB,GAAG,qBAAqB;IAClG,cAAc,EAAE,OAAO,CAAC;IACxB,UAAU,EAAE,WAAW,CAAC;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,mBAAmB,CAAC;IAC/B,UAAU,CAAC,EAAE,qBAAqB,CAAC;IACnC,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B,MAAM,EAAE,iBAAiB,CAAC;IAC1B,WAAW,EAAE,qBAAqB,EAAE,CAAC;CACtC;AAED,MAAM,MAAM,oBAAoB,CAAC,WAAW,SAAS,qBAAqB,GAAG,qBAAqB,IAC9F;IACE,EAAE,EAAE,IAAI,CAAC;IACT,MAAM,EAAE,iBAAiB,CAAC,WAAW,CAAC,CAAC;CACxC,GACD;IACE,EAAE,EAAE,KAAK,CAAC;IACV,KAAK,EAAE,KAAK,CAAC;CACd,CAAC"}
package/dist/types.js ADDED
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
package/package.json ADDED
@@ -0,0 +1,57 @@
1
+ {
2
+ "name": "frontmatter-kit",
3
+ "version": "0.1.0",
4
+ "description": "Parse and inspect front matter with typed metadata, body ranges and readable diagnostics.",
5
+ "type": "module",
6
+ "sideEffects": false,
7
+ "license": "MPL-2.0",
8
+ "author": "Recoveredd",
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "git+https://github.com/Recoveredd/frontmatter-kit.git"
12
+ },
13
+ "bugs": {
14
+ "url": "https://github.com/Recoveredd/frontmatter-kit/issues"
15
+ },
16
+ "homepage": "https://github.com/Recoveredd/frontmatter-kit#readme",
17
+ "keywords": [
18
+ "frontmatter",
19
+ "front-matter",
20
+ "markdown",
21
+ "yaml",
22
+ "toml",
23
+ "json",
24
+ "parser",
25
+ "typescript"
26
+ ],
27
+ "exports": {
28
+ ".": {
29
+ "types": "./dist/index.d.ts",
30
+ "import": "./dist/index.js"
31
+ }
32
+ },
33
+ "types": "./dist/index.d.ts",
34
+ "files": [
35
+ "dist",
36
+ "README.md",
37
+ "CHANGELOG.md",
38
+ "LICENSE"
39
+ ],
40
+ "publishConfig": {
41
+ "access": "public"
42
+ },
43
+ "engines": {
44
+ "node": ">=20"
45
+ },
46
+ "scripts": {
47
+ "build": "tsc -p tsconfig.build.json",
48
+ "prepack": "npm run build",
49
+ "test": "vitest run --config vitest.config.ts",
50
+ "typecheck": "tsc -p tsconfig.json --noEmit"
51
+ },
52
+ "devDependencies": {
53
+ "@types/node": "^24.10.1",
54
+ "typescript": "^5.9.3",
55
+ "vitest": "^4.0.8"
56
+ }
57
+ }