@ubean/content 0.1.7 → 0.1.9
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 +2 -2
- package/dist/index.js +2 -2
- package/dist/{runtime-C8qrycGf.js → runtime-CFSiWnSJ.js} +2 -28
- package/dist/{runtime-zD72Z3v3.d.ts → runtime-DN9pr02v.d.ts} +1 -7
- package/dist/runtime.d.ts +2 -2
- package/dist/runtime.js +2 -2
- package/dist/vite.js +1 -1
- package/package.json +5 -4
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import ubeanContentPlugin, { UbeanContentOptions } from "./vite.js";
|
|
2
|
-
import { A as
|
|
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,
|
|
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 {
|
|
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,
|
|
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 {
|
|
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 {
|
|
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 {
|
|
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,
|
|
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 {
|
|
2
|
-
export { buildNavigation, configureContentRuntime, createContentCollection, createQueryBuilder, defineCollection, defineContentCollection, fetchContentNavigation, generateId, getCollection, getContentItem, listCollections,
|
|
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-
|
|
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.
|
|
3
|
+
"version": "0.1.9",
|
|
4
4
|
"description": "File-based content module for ubean (markdown/MDX/YAML/JSON)",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist"
|
|
@@ -26,11 +26,12 @@
|
|
|
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.9"
|
|
30
31
|
},
|
|
31
32
|
"devDependencies": {
|
|
32
|
-
"@types/node": "^26.1.
|
|
33
|
-
"typescript": "
|
|
33
|
+
"@types/node": "^26.1.2",
|
|
34
|
+
"typescript": "7.0.2",
|
|
34
35
|
"vite": "npm:@voidzero-dev/vite-plus-core@0.2.6",
|
|
35
36
|
"vite-plus": "0.2.6"
|
|
36
37
|
},
|