@vertesia/build-tools 1.4.0-dev.20260615.051508Z → 1.4.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.
@@ -1,6 +1,3 @@
1
- /**
2
- * Frontmatter parser utility using gray-matter
3
- */
4
1
  export interface FrontmatterResult {
5
2
  /** Parsed frontmatter data */
6
3
  frontmatter: Record<string, unknown>;
@@ -1 +1 @@
1
- {"version":3,"file":"frontmatter.d.ts","sourceRoot":"","sources":["../../../src/core/parsers/frontmatter.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,MAAM,WAAW,iBAAiB;IAC9B,8BAA8B;IAC9B,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAErC,kCAAkC;IAClC,OAAO,EAAE,MAAM,CAAC;IAEhB,4BAA4B;IAC5B,QAAQ,EAAE,MAAM,CAAC;CACpB;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,iBAAiB,CAQnE"}
1
+ {"version":3,"file":"frontmatter.d.ts","sourceRoot":"","sources":["../../../src/core/parsers/frontmatter.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,iBAAiB;IAC9B,8BAA8B;IAC9B,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAErC,kCAAkC;IAClC,OAAO,EAAE,MAAM,CAAC;IAEhB,4BAA4B;IAC5B,QAAQ,EAAE,MAAM,CAAC;CACpB;AAID;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,iBAAiB,CAmBnE"}
@@ -1,7 +1,5 @@
1
- /**
2
- * Frontmatter parser utility using gray-matter
3
- */
4
- import matter from 'gray-matter';
1
+ import { load as loadYaml } from 'js-yaml';
2
+ const FRONTMATTER_PATTERN = /^---[ \t]*\r?\n([\s\S]*?)\r?\n---[ \t]*(?:\r?\n|$)/;
5
3
  /**
6
4
  * Parse YAML frontmatter from markdown content
7
5
  *
@@ -9,10 +7,19 @@ import matter from 'gray-matter';
9
7
  * @returns Parsed frontmatter and content
10
8
  */
11
9
  export function parseFrontmatter(content) {
12
- const result = matter(content);
10
+ const match = FRONTMATTER_PATTERN.exec(content);
11
+ if (!match) {
12
+ return {
13
+ frontmatter: {},
14
+ content,
15
+ original: content,
16
+ };
17
+ }
18
+ const parsed = loadYaml(match[1] ?? '');
19
+ const frontmatter = parsed && typeof parsed === 'object' && !Array.isArray(parsed) ? parsed : {};
13
20
  return {
14
- frontmatter: result.data,
15
- content: result.content,
21
+ frontmatter,
22
+ content: content.slice(match[0].length),
16
23
  original: content,
17
24
  };
18
25
  }
@@ -1 +1 @@
1
- {"version":3,"file":"frontmatter.js","sourceRoot":"","sources":["../../../src/core/parsers/frontmatter.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,MAAM,MAAM,aAAa,CAAC;AAajC;;;;;GAKG;AACH,MAAM,UAAU,gBAAgB,CAAC,OAAe;IAC5C,MAAM,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC;IAE/B,OAAO;QACH,WAAW,EAAE,MAAM,CAAC,IAAI;QACxB,OAAO,EAAE,MAAM,CAAC,OAAO;QACvB,QAAQ,EAAE,OAAO;KACpB,CAAC;AACN,CAAC"}
1
+ {"version":3,"file":"frontmatter.js","sourceRoot":"","sources":["../../../src/core/parsers/frontmatter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,IAAI,QAAQ,EAAE,MAAM,SAAS,CAAC;AAa3C,MAAM,mBAAmB,GAAG,oDAAoD,CAAC;AAEjF;;;;;GAKG;AACH,MAAM,UAAU,gBAAgB,CAAC,OAAe;IAC5C,MAAM,KAAK,GAAG,mBAAmB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAChD,IAAI,CAAC,KAAK,EAAE,CAAC;QACT,OAAO;YACH,WAAW,EAAE,EAAE;YACf,OAAO;YACP,QAAQ,EAAE,OAAO;SACpB,CAAC;IACN,CAAC;IAED,MAAM,MAAM,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;IACxC,MAAM,WAAW,GACb,MAAM,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAE,MAAkC,CAAC,CAAC,CAAC,EAAE,CAAC;IAE9G,OAAO;QACH,WAAW;QACX,OAAO,EAAE,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;QACvC,QAAQ,EAAE,OAAO;KACpB,CAAC;AACN,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vertesia/build-tools",
3
- "version": "1.4.0-dev.20260615.051508Z",
3
+ "version": "1.4.0",
4
4
  "description": "Build tools for Vertesia projects - import transformers (skill / template / prompt / raw), esbuild widget bundler, vertesia-build CLI, and a Vite dev plugin",
5
5
  "type": "module",
6
6
  "main": "./lib/index.js",
@@ -25,27 +25,23 @@
25
25
  },
26
26
  "devDependencies": {
27
27
  "@hono/node-server": "^2.0.4",
28
- "@types/node": "^24.12.4",
28
+ "@types/js-yaml": "^4.0.9",
29
+ "@types/node": "^24.13.2",
29
30
  "typescript": "^6.0.3",
30
31
  "vite": "^8.0.16",
31
- "vitest": "^4.1.8",
32
+ "vitest": "^4.1.9",
32
33
  "@vertesia/tsconfig": "0.1.0"
33
34
  },
34
35
  "dependencies": {
35
- "@rollup/plugin-commonjs": "^28.0.3",
36
- "@rollup/plugin-json": "^6.1.0",
37
- "@rollup/plugin-node-resolve": "^16.0.1",
38
- "@rollup/plugin-terser": "^0.4.4",
39
- "@rollup/plugin-typescript": "^12.1.2",
40
- "esbuild": "^0.28.0",
41
- "gray-matter": "^4.0.3",
36
+ "esbuild": "^0.28.1",
37
+ "js-yaml": "^4.2.0",
42
38
  "zod": "^4.4.3",
43
- "@vertesia/common": "1.4.0-dev.20260615.051508Z",
44
- "@llumiverse/common": "1.3.0"
39
+ "@llumiverse/common": "1.4.0",
40
+ "@vertesia/common": "1.4.0"
45
41
  },
46
42
  "peerDependencies": {
47
- "@hono/node-server": "^2.0.0",
48
- "vite": "^8.0.0"
43
+ "@hono/node-server": "^2.0.4",
44
+ "vite": "^8.0.16"
49
45
  },
50
46
  "peerDependenciesMeta": {
51
47
  "@hono/node-server": {
@@ -80,7 +76,8 @@
80
76
  "lint": "biome lint src",
81
77
  "test": "vitest run",
82
78
  "typecheck:test": "tsc -p tsconfig.test.json --noEmit",
83
- "build": "rm -rf ./lib ./tsconfig.tsbuildinfo && tsc && chmod +x ./lib/bin/build.js",
84
- "clean": "rm -rf ./node_modules ./lib ./tsconfig.tsbuildinfo"
79
+ "clean:lib": "rimraf ./lib ./tsconfig.tsbuildinfo",
80
+ "build": "pnpm run clean:lib && tsc -p tsconfig.json && chmod +x ./lib/bin/build.js",
81
+ "clean": "rimraf ./node_modules ./lib ./tsconfig.tsbuildinfo"
85
82
  }
86
83
  }
@@ -1,8 +1,4 @@
1
- /**
2
- * Frontmatter parser utility using gray-matter
3
- */
4
-
5
- import matter from 'gray-matter';
1
+ import { load as loadYaml } from 'js-yaml';
6
2
 
7
3
  export interface FrontmatterResult {
8
4
  /** Parsed frontmatter data */
@@ -15,6 +11,8 @@ export interface FrontmatterResult {
15
11
  original: string;
16
12
  }
17
13
 
14
+ const FRONTMATTER_PATTERN = /^---[ \t]*\r?\n([\s\S]*?)\r?\n---[ \t]*(?:\r?\n|$)/;
15
+
18
16
  /**
19
17
  * Parse YAML frontmatter from markdown content
20
18
  *
@@ -22,11 +20,22 @@ export interface FrontmatterResult {
22
20
  * @returns Parsed frontmatter and content
23
21
  */
24
22
  export function parseFrontmatter(content: string): FrontmatterResult {
25
- const result = matter(content);
23
+ const match = FRONTMATTER_PATTERN.exec(content);
24
+ if (!match) {
25
+ return {
26
+ frontmatter: {},
27
+ content,
28
+ original: content,
29
+ };
30
+ }
31
+
32
+ const parsed = loadYaml(match[1] ?? '');
33
+ const frontmatter =
34
+ parsed && typeof parsed === 'object' && !Array.isArray(parsed) ? (parsed as Record<string, unknown>) : {};
26
35
 
27
36
  return {
28
- frontmatter: result.data,
29
- content: result.content,
37
+ frontmatter,
38
+ content: content.slice(match[0].length),
30
39
  original: content,
31
40
  };
32
41
  }