@ubean/content 0.1.8 → 0.1.10

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/dist/index.d.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  import ubeanContentPlugin, { UbeanContentOptions } from "./vite.js";
2
- import { A as ContentQueryBuilder, C as pathToTitle, D as ContentFieldSchema, E as ContentDocument, F as MarkdownNode, I as ParsedContentMeta, M as ContentSourceConfig, N as ContentTocItem, O as ContentModuleOptions, P as ContentType, S as parseMarkdown, T as ContentCollection, _ as getExtension, a as getContentItem, b as parseContent, c as queryCollection, d as createContentCollection, f as createQueryBuilder, g as getDirname, h as getBasename, i as getCollection, j as ContentSchema, k as ContentNavigationItem, l as registerContent, m as generateId, n as defineCollection, o as listCollections, p as defineContentCollection, r as fetchContentNavigation, s as parseContentFile, t as configureContentRuntime, u as buildNavigation, v as getStem, w as ContentBody, x as parseFrontmatter, y as normalizePath } from "./runtime-zD72Z3v3.js";
3
- export { type ContentBody, type ContentCollection, type ContentDocument, type ContentFieldSchema, type ContentModuleOptions, type ContentNavigationItem, type ContentQueryBuilder, type ContentSchema, type ContentSourceConfig, type ContentTocItem, type ContentType, type MarkdownNode, type ParsedContentMeta, type UbeanContentOptions, buildNavigation, configureContentRuntime, createContentCollection, createQueryBuilder, defineCollection, defineContentCollection, fetchContentNavigation, fetchContentNavigation as fetchNavigation, generateId, getBasename, getCollection, getContentItem, getDirname, getExtension, getStem, listCollections, normalizePath, parseContent, parseContentFile, parseFrontmatter, parseMarkdown, pathToTitle, queryCollection, queryCollection as queryContent, registerContent, ubeanContentPlugin };
2
+ import { A as ParsedContentMeta, C as ContentNavigationItem, D as ContentTocItem, E as ContentSourceConfig, O as ContentType, S as ContentModuleOptions, T as ContentSchema, _ as parseMarkdown, a as getContentItem, b as ContentDocument, c as queryCollection, d as createContentCollection, f as createQueryBuilder, g as parseFrontmatter, h as parseContent, i as getCollection, k as MarkdownNode, l as registerContent, m as generateId, n as defineCollection, o as listCollections, p as defineContentCollection, r as fetchContentNavigation, s as parseContentFile, t as configureContentRuntime, u as buildNavigation, v as ContentBody, w as ContentQueryBuilder, x as ContentFieldSchema, y as ContentCollection } from "./runtime-DN9pr02v.js";
3
+ export { type ContentBody, type ContentCollection, type ContentDocument, type ContentFieldSchema, type ContentModuleOptions, type ContentNavigationItem, type ContentQueryBuilder, type ContentSchema, type ContentSourceConfig, type ContentTocItem, type ContentType, type MarkdownNode, type ParsedContentMeta, type UbeanContentOptions, buildNavigation, configureContentRuntime, createContentCollection, createQueryBuilder, defineCollection, defineContentCollection, fetchContentNavigation, fetchContentNavigation as fetchNavigation, generateId, getCollection, getContentItem, listCollections, parseContent, parseContentFile, parseFrontmatter, parseMarkdown, queryCollection, queryCollection as queryContent, registerContent, ubeanContentPlugin };
package/dist/index.js CHANGED
@@ -1,3 +1,3 @@
1
- import { C as pathToTitle, S as parseMarkdown, _ as getExtension, a as getContentItem, b as parseContent, c as queryCollection, d as createContentCollection, f as createQueryBuilder, g as getDirname, h as getBasename, i as getCollection, l as registerContent, m as generateId, n as defineCollection, o as listCollections, p as defineContentCollection, r as fetchContentNavigation, s as parseContentFile, t as configureContentRuntime, u as buildNavigation, v as getStem, x as parseFrontmatter, y as normalizePath } from "./runtime-C8qrycGf.js";
1
+ import { _ as parseMarkdown, a as getContentItem, c as queryCollection, d as createContentCollection, f as createQueryBuilder, g as parseFrontmatter, h as parseContent, i as getCollection, l as registerContent, m as generateId, n as defineCollection, o as listCollections, p as defineContentCollection, r as fetchContentNavigation, s as parseContentFile, t as configureContentRuntime, u as buildNavigation } from "./runtime-CFSiWnSJ.js";
2
2
  import ubeanContentPlugin from "./vite.js";
3
- export { buildNavigation, configureContentRuntime, createContentCollection, createQueryBuilder, defineCollection, defineContentCollection, fetchContentNavigation, fetchContentNavigation as fetchNavigation, generateId, getBasename, getCollection, getContentItem, getDirname, getExtension, getStem, listCollections, normalizePath, parseContent, parseContentFile, parseFrontmatter, parseMarkdown, pathToTitle, queryCollection, queryCollection as queryContent, registerContent, ubeanContentPlugin };
3
+ export { buildNavigation, configureContentRuntime, createContentCollection, createQueryBuilder, defineCollection, defineContentCollection, fetchContentNavigation, fetchContentNavigation as fetchNavigation, generateId, getCollection, getContentItem, listCollections, parseContent, parseContentFile, parseFrontmatter, parseMarkdown, queryCollection, queryCollection as queryContent, registerContent, ubeanContentPlugin };
@@ -1,3 +1,4 @@
1
+ import { getBasename, getDirname, getExtension, getStem, normalizePath, pathToTitle } from "@ubean/utils";
1
2
  import { kebabCase } from "scule";
2
3
  //#region src/core.ts
3
4
  function generateId(path, extension) {
@@ -8,33 +9,6 @@ function generateId(path, extension) {
8
9
  }
9
10
  return `content:${cleanPath.replace(/\.[^.]+$/, "")}`;
10
11
  }
11
- function getDirname(path) {
12
- const parts = path.split("/");
13
- parts.pop();
14
- return parts.join("/") || "/";
15
- }
16
- function getBasename(path) {
17
- const parts = path.split("/");
18
- return parts[parts.length - 1];
19
- }
20
- function getExtension(filename) {
21
- const match = filename.match(/\.([^.]+)$/);
22
- return match ? match[1].toLowerCase() : "";
23
- }
24
- function getStem(filename) {
25
- return filename.replace(/\.[^.]+$/, "");
26
- }
27
- function normalizePath(path) {
28
- return `/${path.replace(/\\/g, "/").replace(/^\/+/, "").replace(/\/+$/, "").replace(/\/+/g, "/")}`;
29
- }
30
- function pathToTitle(path) {
31
- const stem = getStem(getBasename(path));
32
- if (stem === "index") return kebabCase(getBasename(getDirname(path)) || "home").split("-").map(capitalize).join(" ");
33
- return kebabCase(stem).split("-").map(capitalize).join(" ");
34
- }
35
- function capitalize(str) {
36
- return str.charAt(0).toUpperCase() + str.slice(1);
37
- }
38
12
  function parseFrontmatter(content) {
39
13
  const data = {};
40
14
  const fmMatch = content.match(/^---\s*\n([\s\S]*?)\n---\s*\n?([\s\S]*)$/);
@@ -555,4 +529,4 @@ function parseContentFile(raw, filePath, options) {
555
529
  return parseContent(raw, filePath, options);
556
530
  }
557
531
  //#endregion
558
- export { pathToTitle as C, parseMarkdown as S, getExtension as _, getContentItem as a, parseContent as b, queryCollection as c, createContentCollection as d, createQueryBuilder as f, getDirname as g, getBasename as h, getCollection as i, registerContent as l, generateId as m, defineCollection as n, listCollections as o, defineContentCollection as p, fetchContentNavigation as r, parseContentFile as s, configureContentRuntime as t, buildNavigation as u, getStem as v, parseFrontmatter as x, normalizePath as y };
532
+ export { parseMarkdown as _, getContentItem as a, queryCollection as c, createContentCollection as d, createQueryBuilder as f, parseFrontmatter as g, parseContent as h, getCollection as i, registerContent as l, generateId as m, defineCollection as n, listCollections as o, defineContentCollection as p, fetchContentNavigation as r, parseContentFile as s, configureContentRuntime as t, buildNavigation as u };
@@ -147,12 +147,6 @@ interface ContentNavigationItem {
147
147
  //#endregion
148
148
  //#region src/core.d.ts
149
149
  declare function generateId(path: string, extension?: string): string;
150
- declare function getDirname(path: string): string;
151
- declare function getBasename(path: string): string;
152
- declare function getExtension(filename: string): string;
153
- declare function getStem(filename: string): string;
154
- declare function normalizePath(path: string): string;
155
- declare function pathToTitle(path: string): string;
156
150
  declare function parseFrontmatter(content: string): {
157
151
  data: Record<string, any>;
158
152
  content: string;
@@ -192,4 +186,4 @@ declare function parseContentFile(raw: string, filePath: string, options?: {
192
186
  type?: string;
193
187
  }): ContentDocument;
194
188
  //#endregion
195
- export { ContentQueryBuilder as A, pathToTitle as C, ContentFieldSchema as D, ContentDocument as E, MarkdownNode as F, ParsedContentMeta as I, ContentSourceConfig as M, ContentTocItem as N, ContentModuleOptions as O, ContentType as P, parseMarkdown as S, ContentCollection as T, getExtension as _, getContentItem as a, parseContent as b, queryCollection as c, createContentCollection as d, createQueryBuilder as f, getDirname as g, getBasename as h, getCollection as i, ContentSchema as j, ContentNavigationItem as k, registerContent as l, generateId as m, defineCollection as n, listCollections as o, defineContentCollection as p, fetchContentNavigation as r, parseContentFile as s, configureContentRuntime as t, buildNavigation as u, getStem as v, ContentBody as w, parseFrontmatter as x, normalizePath as y };
189
+ export { ParsedContentMeta as A, ContentNavigationItem as C, ContentTocItem as D, ContentSourceConfig as E, ContentType as O, ContentModuleOptions as S, ContentSchema as T, parseMarkdown as _, getContentItem as a, ContentDocument as b, queryCollection as c, createContentCollection as d, createQueryBuilder as f, parseFrontmatter as g, parseContent as h, getCollection as i, MarkdownNode as k, registerContent as l, generateId as m, defineCollection as n, listCollections as o, defineContentCollection as p, fetchContentNavigation as r, parseContentFile as s, configureContentRuntime as t, buildNavigation as u, ContentBody as v, ContentQueryBuilder as w, ContentFieldSchema as x, ContentCollection as y };
package/dist/runtime.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import { A as ContentQueryBuilder, C as pathToTitle, E as ContentDocument, F as MarkdownNode, M as ContentSourceConfig, N as ContentTocItem, O as ContentModuleOptions, P as ContentType, S as parseMarkdown, T as ContentCollection, a as getContentItem, b as parseContent, c as queryCollection, d as createContentCollection, f as createQueryBuilder, i as getCollection, j as ContentSchema, k as ContentNavigationItem, l as registerContent, m as generateId, n as defineCollection, o as listCollections, p as defineContentCollection, r as fetchContentNavigation, s as parseContentFile, t as configureContentRuntime, u as buildNavigation, w as ContentBody, x as parseFrontmatter, y as normalizePath } from "./runtime-zD72Z3v3.js";
2
- export { type ContentBody, type ContentCollection, type ContentDocument, type ContentModuleOptions, type ContentNavigationItem, type ContentQueryBuilder, type ContentSchema, type ContentSourceConfig, type ContentTocItem, type ContentType, type MarkdownNode, buildNavigation, configureContentRuntime, createContentCollection, createQueryBuilder, defineCollection, defineContentCollection, fetchContentNavigation, generateId, getCollection, getContentItem, listCollections, normalizePath, parseContent, parseContentFile, parseFrontmatter, parseMarkdown, pathToTitle, queryCollection, registerContent };
1
+ import { C as ContentNavigationItem, D as ContentTocItem, E as ContentSourceConfig, O as ContentType, S as ContentModuleOptions, T as ContentSchema, _ as parseMarkdown, a as getContentItem, b as ContentDocument, c as queryCollection, d as createContentCollection, f as createQueryBuilder, g as parseFrontmatter, h as parseContent, i as getCollection, k as MarkdownNode, l as registerContent, m as generateId, n as defineCollection, o as listCollections, p as defineContentCollection, r as fetchContentNavigation, s as parseContentFile, t as configureContentRuntime, u as buildNavigation, v as ContentBody, w as ContentQueryBuilder, y as ContentCollection } from "./runtime-DN9pr02v.js";
2
+ export { type ContentBody, type ContentCollection, type ContentDocument, type ContentModuleOptions, type ContentNavigationItem, type ContentQueryBuilder, type ContentSchema, type ContentSourceConfig, type ContentTocItem, type ContentType, type MarkdownNode, buildNavigation, configureContentRuntime, createContentCollection, createQueryBuilder, defineCollection, defineContentCollection, fetchContentNavigation, generateId, getCollection, getContentItem, listCollections, parseContent, parseContentFile, parseFrontmatter, parseMarkdown, queryCollection, registerContent };
package/dist/runtime.js CHANGED
@@ -1,2 +1,2 @@
1
- import { C as pathToTitle, S as parseMarkdown, a as getContentItem, b as parseContent, c as queryCollection, d as createContentCollection, f as createQueryBuilder, i as getCollection, l as registerContent, m as generateId, n as defineCollection, o as listCollections, p as defineContentCollection, r as fetchContentNavigation, s as parseContentFile, t as configureContentRuntime, u as buildNavigation, x as parseFrontmatter, y as normalizePath } from "./runtime-C8qrycGf.js";
2
- export { buildNavigation, configureContentRuntime, createContentCollection, createQueryBuilder, defineCollection, defineContentCollection, fetchContentNavigation, generateId, getCollection, getContentItem, listCollections, normalizePath, parseContent, parseContentFile, parseFrontmatter, parseMarkdown, pathToTitle, queryCollection, registerContent };
1
+ import { _ as parseMarkdown, a as getContentItem, c as queryCollection, d as createContentCollection, f as createQueryBuilder, g as parseFrontmatter, h as parseContent, i as getCollection, l as registerContent, m as generateId, n as defineCollection, o as listCollections, p as defineContentCollection, r as fetchContentNavigation, s as parseContentFile, t as configureContentRuntime, u as buildNavigation } from "./runtime-CFSiWnSJ.js";
2
+ export { buildNavigation, configureContentRuntime, createContentCollection, createQueryBuilder, defineCollection, defineContentCollection, fetchContentNavigation, generateId, getCollection, getContentItem, listCollections, parseContent, parseContentFile, parseFrontmatter, parseMarkdown, queryCollection, registerContent };
package/dist/vite.js CHANGED
@@ -1,4 +1,4 @@
1
- import { l as registerContent, s as parseContentFile, t as configureContentRuntime } from "./runtime-C8qrycGf.js";
1
+ import { l as registerContent, s as parseContentFile, t as configureContentRuntime } from "./runtime-CFSiWnSJ.js";
2
2
  import { existsSync, readFileSync, readdirSync, statSync } from "node:fs";
3
3
  import { defu } from "defu";
4
4
  import { join, relative, resolve } from "pathe";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ubean/content",
3
- "version": "0.1.8",
3
+ "version": "0.1.10",
4
4
  "description": "File-based content module for ubean (markdown/MDX/YAML/JSON)",
5
5
  "files": [
6
6
  "dist"
@@ -26,7 +26,8 @@
26
26
  "dependencies": {
27
27
  "defu": "6.1.7",
28
28
  "pathe": "^2.0.3",
29
- "scule": "^1.3.0"
29
+ "scule": "^1.3.0",
30
+ "@ubean/utils": "0.1.10"
30
31
  },
31
32
  "devDependencies": {
32
33
  "@types/node": "^26.1.2",