@krate/core 0.3.0 → 0.4.0-beta.2
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/bin/krate +0 -0
- package/dist/config.d.ts +124 -24
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +29 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/package.json +11 -8
package/bin/krate
CHANGED
|
Binary file
|
package/dist/config.d.ts
CHANGED
|
@@ -11,11 +11,12 @@
|
|
|
11
11
|
* outDir: "dist",
|
|
12
12
|
* plugins: [
|
|
13
13
|
* sitemap({ baseUrl: "https://example.com" }),
|
|
14
|
-
* docs({ contentDir: "content/docs", title: "Docs" }),
|
|
14
|
+
* docs({ contentDir: "src/content/docs", title: "Docs" }),
|
|
15
15
|
* ],
|
|
16
16
|
* });
|
|
17
17
|
* ```
|
|
18
18
|
*/
|
|
19
|
+
import type { DocsSearchOptions, DocsSidebarItem, DocsThemeDescriptor, DocsThemeOptions } from "@krate/plugin";
|
|
19
20
|
export interface DevServerConfig {
|
|
20
21
|
/** Dev server port (default: 3000). */
|
|
21
22
|
port?: number;
|
|
@@ -84,35 +85,26 @@ export interface RobotsConfig {
|
|
|
84
85
|
disallow?: string;
|
|
85
86
|
sitemap?: string;
|
|
86
87
|
}
|
|
87
|
-
export interface DocsSidebarItem {
|
|
88
|
-
title?: string;
|
|
89
|
-
url?: string;
|
|
90
|
-
children?: DocsSidebarItem[];
|
|
91
|
-
}
|
|
92
|
-
export interface DocsSearchOptions {
|
|
93
|
-
/**
|
|
94
|
-
* Turn the search bar on/off (default: true).
|
|
95
|
-
*/
|
|
96
|
-
enabled?: boolean;
|
|
97
|
-
/**
|
|
98
|
-
* Index backend. "docfind" (default) builds a WASM search index with the
|
|
99
|
-
* documents embedded in-process at build time; "json" uses the classic
|
|
100
|
-
* search-index.json. The client falls back to JSON automatically when the
|
|
101
|
-
* WASM index is unavailable.
|
|
102
|
-
*/
|
|
103
|
-
engine?: "docfind" | "json";
|
|
104
|
-
/**
|
|
105
|
-
* Max number of results shown (default: 8).
|
|
106
|
-
*/
|
|
107
|
-
maxResults?: number;
|
|
108
|
-
}
|
|
109
88
|
export interface DocsPluginOptions {
|
|
110
89
|
/** Directory of markdown/mdx docs, relative to project root. */
|
|
111
90
|
contentDir?: string;
|
|
112
91
|
/** Site title shown in the docs layout. */
|
|
113
92
|
title?: string;
|
|
114
|
-
/**
|
|
93
|
+
/**
|
|
94
|
+
* Path to a layout component, relative to project root. The layout receives
|
|
95
|
+
* a single {@link DocsLayoutProps} object and owns the docs chrome (navbar,
|
|
96
|
+
* sidebar, TOC, breadcrumbs, prev/next, social links).
|
|
97
|
+
*/
|
|
115
98
|
layout?: string;
|
|
99
|
+
/**
|
|
100
|
+
* Docs theme — the component every generated docs page is rendered through.
|
|
101
|
+
* Like {@link layout}: a root-relative file path (`./` or `/`) or an npm
|
|
102
|
+
* package name (a docs theme installed from a registry) — or a theme
|
|
103
|
+
* descriptor returned by a theme factory (bare object). `theme` and
|
|
104
|
+
* `layout` are aliases: set only one unless both resolve to the same
|
|
105
|
+
* component.
|
|
106
|
+
*/
|
|
107
|
+
theme?: DocsThemeDescriptor<DocsThemeOptions> | string;
|
|
116
108
|
/** Custom sidebar override. */
|
|
117
109
|
sidebar?: DocsSidebarItem[];
|
|
118
110
|
/** Social links rendered in the docs layout. */
|
|
@@ -122,7 +114,13 @@ export interface DocsPluginOptions {
|
|
|
122
114
|
}[];
|
|
123
115
|
/** Search bar configuration (docfind WASM search). */
|
|
124
116
|
search?: DocsSearchOptions;
|
|
117
|
+
/**
|
|
118
|
+
* Base URL for "Edit this page" links (e.g. a GitHub blob URL). The per-page
|
|
119
|
+
* frontmatter `editUrl` key overrides it.
|
|
120
|
+
*/
|
|
121
|
+
editLinkBase?: string;
|
|
125
122
|
}
|
|
123
|
+
export type { DocsHeadTag, DocsHero, DocsLayoutProps, DocsSearchOptions, DocsSidebarItem, DocsThemeDescriptor, DocsThemeOptions, } from "@krate/plugin";
|
|
126
124
|
export interface SitemapPluginOptions {
|
|
127
125
|
/** e.g. "https://example.com" (falls back to `seo.baseUrl`). */
|
|
128
126
|
baseUrl: string;
|
|
@@ -160,6 +158,33 @@ export interface KrateConfig {
|
|
|
160
158
|
runtimeDirs?: string[];
|
|
161
159
|
pathAliases?: Record<string, string[]>;
|
|
162
160
|
tsBaseDir?: string;
|
|
161
|
+
/**
|
|
162
|
+
* Output mode. Default (`undefined`) allows request-time rendering
|
|
163
|
+
* (SSR/ISR/streaming and dynamic route fallbacks). `"static"` produces a
|
|
164
|
+
* fully static build: dynamic routes render only the params returned by
|
|
165
|
+
* `generateStaticParams`, unknown params 404, and SSR/ISR/streaming are
|
|
166
|
+
* disabled. A page can opt back in with `export const dynamicParams = true`.
|
|
167
|
+
*/
|
|
168
|
+
output?: "static";
|
|
169
|
+
/**
|
|
170
|
+
* Compiler-enforced quality gates. When configured, `krate build` runs the
|
|
171
|
+
* rules and fails on findings at or above `failOn`; `krate check` runs the
|
|
172
|
+
* same rules on an existing build. Categories run by default only when a
|
|
173
|
+
* `checks` object is present.
|
|
174
|
+
*/
|
|
175
|
+
checks?: ChecksConfig;
|
|
176
|
+
/**
|
|
177
|
+
* Typed content collections. Either a plain object or `defineContent({...})`:
|
|
178
|
+
*
|
|
179
|
+
* ```ts
|
|
180
|
+
* export default defineConfig({
|
|
181
|
+
* content: defineContent({
|
|
182
|
+
* blog: { dir: "src/content/blog", schema: { title: "string" } },
|
|
183
|
+
* }),
|
|
184
|
+
* });
|
|
185
|
+
* ```
|
|
186
|
+
*/
|
|
187
|
+
content?: ContentConfig;
|
|
163
188
|
/** Optional validation function called at build time with the loaded config. */
|
|
164
189
|
validate?: (config: KrateConfig) => void | Promise<void>;
|
|
165
190
|
}
|
|
@@ -177,4 +202,79 @@ export declare function sitemap(options: SitemapPluginOptions): PluginConfig;
|
|
|
177
202
|
* content directory.
|
|
178
203
|
*/
|
|
179
204
|
export declare function docs(options?: DocsPluginOptions): PluginConfig;
|
|
205
|
+
/** Shorthand field types accepted in a collection schema. */
|
|
206
|
+
export type ContentFieldType = "string" | "number" | "boolean" | "string[]" | "number[]" | "date";
|
|
207
|
+
/** Object form of a schema field. */
|
|
208
|
+
export interface ContentField {
|
|
209
|
+
type: ContentFieldType;
|
|
210
|
+
/** Require the field to be present in frontmatter (default: false). */
|
|
211
|
+
required?: boolean;
|
|
212
|
+
}
|
|
213
|
+
/** One field: a shorthand type string or a {@link ContentField} object. */
|
|
214
|
+
export type ContentFieldSpec = ContentFieldType | ContentField;
|
|
215
|
+
/** A single content collection. */
|
|
216
|
+
export interface ContentCollection {
|
|
217
|
+
/** Directory containing the collection's markdown/mdx entries, relative to
|
|
218
|
+
* the project root (default: `src/content/<name>`). */
|
|
219
|
+
dir?: string;
|
|
220
|
+
/** Frontmatter schema; each key maps to a field spec. */
|
|
221
|
+
schema?: Record<string, ContentFieldSpec>;
|
|
222
|
+
}
|
|
223
|
+
/** The shape passed to {@link defineContent}. */
|
|
224
|
+
export type ContentConfig = Record<string, ContentCollection>;
|
|
225
|
+
/**
|
|
226
|
+
* Define typed content collections. Optional identity helper — you can also
|
|
227
|
+
* pass a plain object to `defineConfig({ content: {...} })`; it exists purely
|
|
228
|
+
* for type-checking and editor assistance.
|
|
229
|
+
*
|
|
230
|
+
* Krate validates each entry's frontmatter against the schema at build time and
|
|
231
|
+
* generates typed declarations (`.krate/types/content.d.ts`).
|
|
232
|
+
*
|
|
233
|
+
* ```ts
|
|
234
|
+
* import { defineConfig, defineContent } from "@krate/core";
|
|
235
|
+
*
|
|
236
|
+
* export default defineConfig({
|
|
237
|
+
* content: defineContent({
|
|
238
|
+
* blog: {
|
|
239
|
+
* dir: "src/content/blog",
|
|
240
|
+
* schema: {
|
|
241
|
+
* title: "string",
|
|
242
|
+
* order: { type: "number", required: true },
|
|
243
|
+
* tags: "string[]",
|
|
244
|
+
* },
|
|
245
|
+
* },
|
|
246
|
+
* }),
|
|
247
|
+
* });
|
|
248
|
+
* ```
|
|
249
|
+
*/
|
|
250
|
+
export declare function defineContent(config: ContentConfig): ContentConfig;
|
|
251
|
+
/** Severity for a check rule or category. `false` disables it. */
|
|
252
|
+
export type CheckSeverity = "error" | "warning" | "off" | boolean;
|
|
253
|
+
/** Built-in check rule IDs. */
|
|
254
|
+
export type CheckRuleId = "a11y/img-alt" | "a11y/heading-order" | "a11y/accessible-name" | "seo/title" | "seo/description" | "seo/canonical" | "seo/og" | "seo/lang" | "perf/js-budget" | "perf/image-dims";
|
|
255
|
+
export interface ChecksConfig {
|
|
256
|
+
/** Master switch (default: true when `checks` is present). */
|
|
257
|
+
enabled?: boolean;
|
|
258
|
+
/** Accessibility rules. `false` turns the category off. */
|
|
259
|
+
a11y?: CheckSeverity;
|
|
260
|
+
/** SEO rules. */
|
|
261
|
+
seo?: CheckSeverity;
|
|
262
|
+
/** Performance-budget rules. */
|
|
263
|
+
perf?: CheckSeverity;
|
|
264
|
+
/** Per-rule severity overrides, keyed by rule ID. */
|
|
265
|
+
rules?: Partial<Record<CheckRuleId, CheckSeverity>>;
|
|
266
|
+
/** Rule IDs to suppress entirely. */
|
|
267
|
+
ignore?: CheckRuleId[];
|
|
268
|
+
/** Per-route budgets. `js` is the client-JS budget in kilobytes. */
|
|
269
|
+
budget?: {
|
|
270
|
+
js?: number;
|
|
271
|
+
};
|
|
272
|
+
/** Minimum severity that fails `krate check` / the build (default "error"). */
|
|
273
|
+
failOn?: "error" | "warning";
|
|
274
|
+
/**
|
|
275
|
+
* Paths (relative to the project root) to JS/TS modules that export a custom
|
|
276
|
+
* `check(page, krate)` rule. Runs in the embedded QuickJS runtime.
|
|
277
|
+
*/
|
|
278
|
+
custom?: string[];
|
|
279
|
+
}
|
|
180
280
|
//# sourceMappingURL=config.d.ts.map
|
package/dist/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],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AA2D;IAC3D,IAAI,CAAC,EAAE,aAAa,CAAC;IACrB,iBAAiB;IACjB,GAAG,CAAC,EAAE,aAAa,CAAC;IACpB,gCAAgC;IAChC,IAAI,CAAC,EAAE,aAAa,CAAC;IACrB,qDAAqD;IACrD,KAAK,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,WAAW,EAAE,aAAa,CAAC,CAAC,CAAC;IACpD,qCAAqC;IACrC,MAAM,CAAC,EAAE,WAAW,EAAE,CAAC;IACvB,oEAAoE;IACpE,MAAM,CAAC,EAAE;QAAE,EAAE,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACzB,+EAA+E;IAC/E,MAAM,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAC7B;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;CACnB"}
|
package/dist/config.js
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
* outDir: "dist",
|
|
12
12
|
* plugins: [
|
|
13
13
|
* sitemap({ baseUrl: "https://example.com" }),
|
|
14
|
-
* docs({ contentDir: "content/docs", title: "Docs" }),
|
|
14
|
+
* docs({ contentDir: "src/content/docs", title: "Docs" }),
|
|
15
15
|
* ],
|
|
16
16
|
* });
|
|
17
17
|
* ```
|
|
@@ -36,3 +36,31 @@ export function sitemap(options) {
|
|
|
36
36
|
export function docs(options = {}) {
|
|
37
37
|
return { name: "docs", order: 10, options };
|
|
38
38
|
}
|
|
39
|
+
/**
|
|
40
|
+
* Define typed content collections. Optional identity helper — you can also
|
|
41
|
+
* pass a plain object to `defineConfig({ content: {...} })`; it exists purely
|
|
42
|
+
* for type-checking and editor assistance.
|
|
43
|
+
*
|
|
44
|
+
* Krate validates each entry's frontmatter against the schema at build time and
|
|
45
|
+
* generates typed declarations (`.krate/types/content.d.ts`).
|
|
46
|
+
*
|
|
47
|
+
* ```ts
|
|
48
|
+
* import { defineConfig, defineContent } from "@krate/core";
|
|
49
|
+
*
|
|
50
|
+
* export default defineConfig({
|
|
51
|
+
* content: defineContent({
|
|
52
|
+
* blog: {
|
|
53
|
+
* dir: "src/content/blog",
|
|
54
|
+
* schema: {
|
|
55
|
+
* title: "string",
|
|
56
|
+
* order: { type: "number", required: true },
|
|
57
|
+
* tags: "string[]",
|
|
58
|
+
* },
|
|
59
|
+
* },
|
|
60
|
+
* }),
|
|
61
|
+
* });
|
|
62
|
+
* ```
|
|
63
|
+
*/
|
|
64
|
+
export function defineContent(config) {
|
|
65
|
+
return config;
|
|
66
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
export { defineConfig, docs, sitemap } from "./config.js";
|
|
2
|
-
export type { KrateConfig, PluginConfig, DevServerConfig, TailwindConfig, CSPConfig, MarkdownConfig, SSRConfig, RedirectConfig, RewriteConfig, SEOConfig, RobotsConfig, DocsPluginOptions, DocsSidebarItem, SitemapPluginOptions, RuntimeName, } from "./config.js";
|
|
1
|
+
export { defineConfig, docs, sitemap, defineContent } from "./config.js";
|
|
2
|
+
export type { KrateConfig, PluginConfig, DevServerConfig, TailwindConfig, CSPConfig, MarkdownConfig, SSRConfig, RedirectConfig, RewriteConfig, SEOConfig, RobotsConfig, DocsPluginOptions, DocsSidebarItem, DocsSearchOptions, DocsThemeDescriptor, DocsThemeOptions, SitemapPluginOptions, RuntimeName, ContentConfig, ContentCollection, ContentField, ContentFieldSpec, ContentFieldType, ChecksConfig, CheckSeverity, CheckRuleId, } from "./config.js";
|
|
3
|
+
export type { DocsLayoutProps } from "./config.js";
|
|
3
4
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,IAAI,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACzE,YAAY,EACV,WAAW,EACX,YAAY,EACZ,eAAe,EACf,cAAc,EACd,SAAS,EACT,cAAc,EACd,SAAS,EACT,cAAc,EACd,aAAa,EACb,SAAS,EACT,YAAY,EACZ,iBAAiB,EACjB,eAAe,EACf,iBAAiB,EACjB,mBAAmB,EACnB,gBAAgB,EAChB,oBAAoB,EACpB,WAAW,EACX,aAAa,EACb,iBAAiB,EACjB,YAAY,EACZ,gBAAgB,EAChB,gBAAgB,EAChB,YAAY,EACZ,aAAa,EACb,WAAW,GACZ,MAAM,aAAa,CAAC;AACrB,YAAY,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { defineConfig, docs, sitemap } from "./config.js";
|
|
1
|
+
export { defineConfig, docs, sitemap, defineContent } from "./config.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@krate/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0-beta.2",
|
|
4
4
|
"description": "The Krate CLI — a Go-native static site generator with signal-based reactivity.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -36,18 +36,21 @@
|
|
|
36
36
|
"dist",
|
|
37
37
|
"install.js"
|
|
38
38
|
],
|
|
39
|
+
"dependencies": {
|
|
40
|
+
"@krate/plugin": "0.4.0-beta.2"
|
|
41
|
+
},
|
|
39
42
|
"devDependencies": {
|
|
40
43
|
"@types/node": "^20.19.43",
|
|
41
44
|
"typescript": "^5.5.0"
|
|
42
45
|
},
|
|
43
46
|
"optionalDependencies": {
|
|
44
|
-
"@krate/core-darwin-arm64": "0.
|
|
45
|
-
"@krate/core-darwin-x64": "0.
|
|
46
|
-
"@krate/core-linux-arm64": "0.
|
|
47
|
-
"@krate/core-linux-x64": "0.
|
|
48
|
-
"@krate/core-linux-x64-musl": "0.
|
|
49
|
-
"@krate/core-win32-arm64": "0.
|
|
50
|
-
"@krate/core-win32-x64": "0.
|
|
47
|
+
"@krate/core-darwin-arm64": "0.4.0-beta.2",
|
|
48
|
+
"@krate/core-darwin-x64": "0.4.0-beta.2",
|
|
49
|
+
"@krate/core-linux-arm64": "0.4.0-beta.2",
|
|
50
|
+
"@krate/core-linux-x64": "0.4.0-beta.2",
|
|
51
|
+
"@krate/core-linux-x64-musl": "0.4.0-beta.2",
|
|
52
|
+
"@krate/core-win32-arm64": "0.4.0-beta.2",
|
|
53
|
+
"@krate/core-win32-x64": "0.4.0-beta.2"
|
|
51
54
|
},
|
|
52
55
|
"scripts": {
|
|
53
56
|
"build": "tsc",
|