blume 0.1.0 → 0.1.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/dist/cli/index.js +1213 -473
- package/dist/cli/index.js.map +33 -29
- package/dist/types/core/bridge.d.ts +24 -0
- package/dist/types/core/config.d.ts +35 -0
- package/dist/types/core/data.d.ts +129 -0
- package/dist/types/core/define-components.d.ts +27 -0
- package/dist/types/core/define-meta.d.ts +16 -0
- package/dist/types/core/deployment-env.d.ts +9 -0
- package/dist/types/core/diagnostics.d.ts +17 -0
- package/dist/types/core/i18n-ui.d.ts +500 -0
- package/dist/types/core/load-module.d.ts +7 -0
- package/dist/types/core/package-root.d.ts +17 -0
- package/dist/types/core/project.d.ts +9 -0
- package/dist/types/core/schema.d.ts +3461 -0
- package/dist/types/core/sources/types.d.ts +107 -0
- package/dist/types/core/types.d.ts +245 -0
- package/dist/types/core/ui-packs/ar.d.ts +3 -0
- package/dist/types/core/ui-packs/bg.d.ts +3 -0
- package/dist/types/core/ui-packs/bn.d.ts +3 -0
- package/dist/types/core/ui-packs/ca.d.ts +3 -0
- package/dist/types/core/ui-packs/cs.d.ts +3 -0
- package/dist/types/core/ui-packs/da.d.ts +3 -0
- package/dist/types/core/ui-packs/de.d.ts +3 -0
- package/dist/types/core/ui-packs/el.d.ts +3 -0
- package/dist/types/core/ui-packs/es.d.ts +3 -0
- package/dist/types/core/ui-packs/fa.d.ts +3 -0
- package/dist/types/core/ui-packs/fi.d.ts +3 -0
- package/dist/types/core/ui-packs/fr.d.ts +3 -0
- package/dist/types/core/ui-packs/he.d.ts +3 -0
- package/dist/types/core/ui-packs/hi.d.ts +3 -0
- package/dist/types/core/ui-packs/hr.d.ts +3 -0
- package/dist/types/core/ui-packs/hu.d.ts +3 -0
- package/dist/types/core/ui-packs/id.d.ts +3 -0
- package/dist/types/core/ui-packs/index.d.ts +13 -0
- package/dist/types/core/ui-packs/it.d.ts +3 -0
- package/dist/types/core/ui-packs/ja.d.ts +3 -0
- package/dist/types/core/ui-packs/ko.d.ts +3 -0
- package/dist/types/core/ui-packs/nl.d.ts +3 -0
- package/dist/types/core/ui-packs/no.d.ts +3 -0
- package/dist/types/core/ui-packs/pl.d.ts +3 -0
- package/dist/types/core/ui-packs/pt-br.d.ts +3 -0
- package/dist/types/core/ui-packs/pt.d.ts +3 -0
- package/dist/types/core/ui-packs/ro.d.ts +3 -0
- package/dist/types/core/ui-packs/ru.d.ts +3 -0
- package/dist/types/core/ui-packs/sk.d.ts +3 -0
- package/dist/types/core/ui-packs/sr.d.ts +3 -0
- package/dist/types/core/ui-packs/sv.d.ts +3 -0
- package/dist/types/core/ui-packs/th.d.ts +3 -0
- package/dist/types/core/ui-packs/tr.d.ts +3 -0
- package/dist/types/core/ui-packs/uk.d.ts +3 -0
- package/dist/types/core/ui-packs/vi.d.ts +3 -0
- package/dist/types/core/ui-packs/zh-tw.d.ts +3 -0
- package/dist/types/core/ui-packs/zh.d.ts +3 -0
- package/dist/types/core/version.d.ts +8 -0
- package/dist/types/index.d.ts +10 -0
- package/dist/types/migrate/mintlify/config.d.ts +2 -0
- package/dist/types/migrate/mintlify/i18n.d.ts +7 -0
- package/dist/types/theme/fonts.d.ts +163 -0
- package/docs/advanced/custom-pages.mdx +91 -10
- package/docs/configuration/index.mdx +19 -0
- package/docs/content/components.mdx +103 -1
- package/package.json +13 -3
- package/src/ai/llms.ts +1 -2
- package/src/astro/examples.ts +106 -0
- package/src/astro/generate.ts +300 -75
- package/src/astro/index.ts +1 -1
- package/src/astro/islands.ts +1 -1
- package/src/astro/pages.ts +59 -0
- package/src/astro/templates.ts +180 -22
- package/src/cli/commands/validate.ts +1 -0
- package/src/components/content/CodeBlock.astro +28 -0
- package/src/components/content/Component.astro +65 -0
- package/src/components/content/Diff.astro +44 -0
- package/src/components/content/Tab.astro +8 -2
- package/src/components/content/diff.ts +95 -0
- package/src/components/layout/Favicon.astro +11 -4
- package/src/components/layout/PageLayout.astro +173 -0
- package/src/components/layout/ReferenceLayout.astro +6 -1
- package/src/components/layout/RootLayout.astro +9 -5
- package/src/components/layout/head-scripts.ts +19 -0
- package/src/core/data.ts +128 -0
- package/src/core/frontmatter.ts +43 -0
- package/src/core/links.ts +26 -10
- package/src/core/schema.ts +8 -0
- package/src/core/sources/filesystem.ts +1 -1
- package/src/core/sources/mdx-remote.ts +1 -2
- package/src/core/sources/mintlify.ts +1 -1
- package/src/core/sources/normalize.ts +19 -3
- package/src/core/sources/notion.ts +1 -1
- package/src/core/sources/sanity.ts +1 -1
- package/src/core/tsconfig-aliases.ts +201 -0
- package/src/index.ts +12 -0
- package/src/markdown/index.ts +69 -0
- package/src/migrate/fumadocs/config.ts +53 -4
- package/src/migrate/fumadocs/content.ts +1 -1
- package/src/migrate/fumadocs/groups.ts +230 -0
- package/src/migrate/fumadocs/index.ts +104 -19
- package/src/migrate/fumadocs/meta.ts +140 -10
- package/src/migrate/mintlify/snippets.ts +2 -1
- package/src/migrate/mintlify/transform.ts +1 -2
- package/src/migrate/nextra/index.ts +1 -1
- package/src/migrate/shared.ts +98 -1
- package/src/migrate/starlight/index.ts +1 -1
- package/src/registry/eject.ts +57 -10
- package/src/search/documents.ts +1 -2
- package/src/theme/entry.ts +29 -0
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { BlumeConfig } from "./schema.ts";
|
|
2
|
+
/** A detected docs-tool config that Blume can serve without a migration. */
|
|
3
|
+
export interface BridgeDetection {
|
|
4
|
+
/** Which foreign docs tool was detected. */
|
|
5
|
+
tool: "mintlify";
|
|
6
|
+
/** Absolute path of the detected config file (`docs.json`/`mint.json`). */
|
|
7
|
+
configFile: string;
|
|
8
|
+
/** A Blume config synthesized from the foreign config, ready to validate. */
|
|
9
|
+
raw: BlumeConfig;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Detect a Mintlify project at `root` and synthesize an equivalent Blume config.
|
|
13
|
+
*
|
|
14
|
+
* "Bridge mode" lets a team swap `mintlify dev` for `blume dev` with no file
|
|
15
|
+
* changes: `docs.json` is translated to Blume config (`loadMintlifyConfig`) and
|
|
16
|
+
* its content block is rewired to a single `mintlify` content source, which
|
|
17
|
+
* transforms each MDX page to Blume idiom at scan time. The original
|
|
18
|
+
* `content.root`/`exclude` and `variables` move onto the source (Blume has no
|
|
19
|
+
* runtime variable substitution, so globals are inlined into content there).
|
|
20
|
+
*
|
|
21
|
+
* Returns `null` when no Mintlify config is present. Only called when no
|
|
22
|
+
* `blume.config.*` exists, so an explicit Blume config always takes precedence.
|
|
23
|
+
*/
|
|
24
|
+
export declare const detectMintlifyBridge: (root: string) => Promise<BridgeDetection | null>;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { BlumeConfig, ResolvedConfig } from "./schema.ts";
|
|
2
|
+
import type { Diagnostic } from "./types.ts";
|
|
3
|
+
/**
|
|
4
|
+
* Identity helper for authoring `blume.config.ts`. Exists for type inference
|
|
5
|
+
* and a stable future home for plugin hooks; it does not transform input.
|
|
6
|
+
*/
|
|
7
|
+
export declare const defineConfig: (config: BlumeConfig) => BlumeConfig;
|
|
8
|
+
/** Bridge mode info: a foreign docs tool Blume is serving without migrating. */
|
|
9
|
+
export interface ConfigBridge {
|
|
10
|
+
tool: "mintlify";
|
|
11
|
+
/** Absolute path of the foreign config file (`docs.json`/`mint.json`). */
|
|
12
|
+
configFile: string;
|
|
13
|
+
}
|
|
14
|
+
/** Result of loading + validating a project config. */
|
|
15
|
+
export interface ConfigLoadResult {
|
|
16
|
+
config: ResolvedConfig;
|
|
17
|
+
/** Absolute path of the config file used, or null when defaults were used. */
|
|
18
|
+
configFile: string | null;
|
|
19
|
+
/** Set when a foreign docs config (e.g. Mintlify) is being bridged. */
|
|
20
|
+
bridge: ConfigBridge | null;
|
|
21
|
+
diagnostics: Diagnostic[];
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Load and validate the project config. When no config file exists, schema
|
|
25
|
+
* defaults produce a fully resolved config so the zero-boilerplate path works.
|
|
26
|
+
*/
|
|
27
|
+
export declare const loadConfig: (root: string,
|
|
28
|
+
/**
|
|
29
|
+
* Supplied only by `blume dev`: the local dev server URL, used as the
|
|
30
|
+
* `deployment.site` fallback when none is configured or detected. Builds
|
|
31
|
+
* never pass it, so production output can't end up pointing at localhost.
|
|
32
|
+
*/
|
|
33
|
+
options?: {
|
|
34
|
+
devServerUrl?: string;
|
|
35
|
+
}) => Promise<ConfigLoadResult>;
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import type { UIStrings } from "./i18n-ui.ts";
|
|
2
|
+
import type { ResolvedConfig, SearchProvider } from "./schema.ts";
|
|
3
|
+
import type { Navigation, RouteAlternate } from "./types.ts";
|
|
4
|
+
/**
|
|
5
|
+
* The shape of the `blume:data` virtual module — the resolved, serializable
|
|
6
|
+
* snapshot of a site that custom `.astro` pages read with
|
|
7
|
+
* `import data from "blume:data"`. `buildRuntimeData` (`astro/generate.ts`)
|
|
8
|
+
* produces exactly this object and annotates it with {@link BlumeData}, so the
|
|
9
|
+
* documented type and the emitted JSON stay in lockstep.
|
|
10
|
+
*/
|
|
11
|
+
/** Resolved site logo: an inlined SVG, or light/dark image URLs. */
|
|
12
|
+
export interface BlumeLogo {
|
|
13
|
+
svg?: string;
|
|
14
|
+
light?: string;
|
|
15
|
+
dark?: string;
|
|
16
|
+
alt: string;
|
|
17
|
+
href: string;
|
|
18
|
+
}
|
|
19
|
+
/** A favicon or apple-touch-icon: a link href plus an optional MIME type. */
|
|
20
|
+
export interface BlumeFavicon {
|
|
21
|
+
href: string;
|
|
22
|
+
type?: string;
|
|
23
|
+
}
|
|
24
|
+
/** Announcement banner, normalized from its config (string shorthand or object). */
|
|
25
|
+
export interface BlumeBanner {
|
|
26
|
+
content: string;
|
|
27
|
+
link?: {
|
|
28
|
+
href: string;
|
|
29
|
+
text: string;
|
|
30
|
+
};
|
|
31
|
+
dismissible: boolean;
|
|
32
|
+
/** Dismissal key: the configured id, else the content itself. */
|
|
33
|
+
key: string;
|
|
34
|
+
}
|
|
35
|
+
/** A generated syndication feed surfaced in the UI. */
|
|
36
|
+
export interface BlumeFeed {
|
|
37
|
+
href: string;
|
|
38
|
+
title: string;
|
|
39
|
+
}
|
|
40
|
+
/** One configured locale, as exposed to the runtime. */
|
|
41
|
+
export interface BlumeDataLocale {
|
|
42
|
+
code: string;
|
|
43
|
+
dir: "ltr" | "rtl";
|
|
44
|
+
label: string;
|
|
45
|
+
}
|
|
46
|
+
/** Resolved i18n settings; `null` when the site is single-locale. */
|
|
47
|
+
export interface BlumeDataI18n {
|
|
48
|
+
defaultLocale: string;
|
|
49
|
+
/** Locale whose content renders for a missing translation; `null` disables it. */
|
|
50
|
+
fallbackLocale: string | null;
|
|
51
|
+
hideDefaultLocalePrefix: boolean;
|
|
52
|
+
locales: BlumeDataLocale[];
|
|
53
|
+
}
|
|
54
|
+
/** A single content route, with the metadata custom pages can read. */
|
|
55
|
+
export interface BlumeRoute {
|
|
56
|
+
/** Locales this logical page is translated into (excludes fallbacks). */
|
|
57
|
+
alternates: RouteAlternate[];
|
|
58
|
+
/** Astro collection the entry renders through (`"docs"` | `"staged"`). */
|
|
59
|
+
collection: string;
|
|
60
|
+
draft: boolean;
|
|
61
|
+
/** "Edit this page" URL, or `null` when no repo/source provides one. */
|
|
62
|
+
editUrl: string | null;
|
|
63
|
+
/** Astro collection entry id (for `getEntry`/`getCollection`); matches `id`. */
|
|
64
|
+
entryId: string;
|
|
65
|
+
/** True when this route renders fallback content for a missing translation. */
|
|
66
|
+
fallback: boolean;
|
|
67
|
+
hidden: boolean;
|
|
68
|
+
id: string;
|
|
69
|
+
/** Whether the page is part of the search index. */
|
|
70
|
+
indexable: boolean;
|
|
71
|
+
/** ISO "last updated" date when the feature is on, else `null`. */
|
|
72
|
+
lastModified: string | null;
|
|
73
|
+
/** Resolved locale code (the default locale when not under i18n). */
|
|
74
|
+
locale: string;
|
|
75
|
+
path: string;
|
|
76
|
+
title: string;
|
|
77
|
+
}
|
|
78
|
+
/** Site-wide settings derived from `blume.config` — the `config` field of {@link BlumeData}. */
|
|
79
|
+
export interface BlumeDataConfig {
|
|
80
|
+
analytics: NonNullable<ResolvedConfig["analytics"]> | null;
|
|
81
|
+
/** Apple touch icon, or `null` when none is configured/detected. */
|
|
82
|
+
appleIcon: BlumeFavicon | null;
|
|
83
|
+
banner: BlumeBanner | null;
|
|
84
|
+
/** `markdown.code.wrap`: wrap long code lines instead of scrolling. */
|
|
85
|
+
codeWrap: boolean;
|
|
86
|
+
description: string | undefined;
|
|
87
|
+
favicon: BlumeFavicon;
|
|
88
|
+
feedback: boolean;
|
|
89
|
+
i18n: BlumeDataI18n | null;
|
|
90
|
+
/** `markdown.imageZoom`: click-to-zoom content images. */
|
|
91
|
+
imageZoom: boolean;
|
|
92
|
+
logo: BlumeLogo | null;
|
|
93
|
+
/** Hosted MCP server, or `null` when MCP is off. */
|
|
94
|
+
mcp: {
|
|
95
|
+
name: string;
|
|
96
|
+
route: string;
|
|
97
|
+
} | null;
|
|
98
|
+
/** Open Graph image generation. */
|
|
99
|
+
og: {
|
|
100
|
+
enabled: boolean;
|
|
101
|
+
};
|
|
102
|
+
/** Repository URL for header/edit links, or `null`. */
|
|
103
|
+
repoUrl: string | null;
|
|
104
|
+
search: {
|
|
105
|
+
enabled: boolean;
|
|
106
|
+
provider: SearchProvider;
|
|
107
|
+
};
|
|
108
|
+
/** Deployment site URL, or `null` when none is configured/detected. */
|
|
109
|
+
site: string | null;
|
|
110
|
+
structuredData: boolean;
|
|
111
|
+
theme: ResolvedConfig["theme"];
|
|
112
|
+
title: string;
|
|
113
|
+
}
|
|
114
|
+
/** The `blume:data` module a Blume site's custom pages import. */
|
|
115
|
+
export interface BlumeData {
|
|
116
|
+
config: BlumeDataConfig;
|
|
117
|
+
feeds: BlumeFeed[];
|
|
118
|
+
/** CSS variable names for the configured fonts (Astro `<Font>` integration). */
|
|
119
|
+
fontCssVars: string[];
|
|
120
|
+
/** Sidebar + tab tree for the default locale. */
|
|
121
|
+
navigation: Navigation;
|
|
122
|
+
/** Per-locale navigation trees, keyed by locale code (empty without i18n). */
|
|
123
|
+
navigationByLocale: Record<string, Navigation>;
|
|
124
|
+
routes: BlumeRoute[];
|
|
125
|
+
/** Resolved UI strings for the default locale. */
|
|
126
|
+
ui: UIStrings;
|
|
127
|
+
/** Per-locale UI strings, keyed by locale code (empty without i18n). */
|
|
128
|
+
uiByLocale: Record<string, UIStrings>;
|
|
129
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { HydrationMode } from "./schema.ts";
|
|
2
|
+
/**
|
|
3
|
+
* A reference to a component. Either an imported component (preferred, for type
|
|
4
|
+
* safety) or a string path resolved relative to the project root.
|
|
5
|
+
*/
|
|
6
|
+
export type ComponentReference = unknown | string;
|
|
7
|
+
/** An interactive component plus its hydration strategy. */
|
|
8
|
+
export interface IslandDescriptor {
|
|
9
|
+
component: ComponentReference;
|
|
10
|
+
client: HydrationMode;
|
|
11
|
+
/** Required when `client` is `"media"`. */
|
|
12
|
+
media?: string;
|
|
13
|
+
}
|
|
14
|
+
/** A component override: a static component or a hydrated island. */
|
|
15
|
+
export type ComponentOverride = ComponentReference | IslandDescriptor;
|
|
16
|
+
/** User-authored component overrides, grouped by surface. */
|
|
17
|
+
export interface ComponentOverrides {
|
|
18
|
+
/** MDX component map overrides (`Callout`, `Card`, ...). */
|
|
19
|
+
mdx?: Record<string, ComponentOverride>;
|
|
20
|
+
/** Layout slot overrides (`Header`, `Sidebar`, `Search`, ...). */
|
|
21
|
+
layout?: Record<string, ComponentOverride>;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Identity helper for authoring `components.ts`. Provides type inference and a
|
|
25
|
+
* stable home for future normalization; it does not transform input.
|
|
26
|
+
*/
|
|
27
|
+
export declare const defineComponents: (overrides: ComponentOverrides) => ComponentOverrides;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { FolderMeta } from "./schema.ts";
|
|
2
|
+
/** A function that computes folder meta, optionally asynchronously. */
|
|
3
|
+
export type FolderMetaFactory = () => FolderMeta | Promise<FolderMeta>;
|
|
4
|
+
/** What a `meta.ts` may default-export: a plain object or a (async) factory. */
|
|
5
|
+
export type FolderMetaDefinition = FolderMeta | FolderMetaFactory;
|
|
6
|
+
/**
|
|
7
|
+
* Identity helper for authoring a folder's `meta.ts`. Provides type inference;
|
|
8
|
+
* it does not transform input. Pass an object, or a function (sync or async)
|
|
9
|
+
* that returns one when you need to compute the meta:
|
|
10
|
+
*
|
|
11
|
+
* ```ts
|
|
12
|
+
* export default defineMeta({ title: "Guides", order: 2 });
|
|
13
|
+
* export default defineMeta(async () => ({ pages: await orderPages() }));
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
export declare const defineMeta: (meta: FolderMetaDefinition) => FolderMetaDefinition;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ResolvedConfig } from "./schema.ts";
|
|
2
|
+
/**
|
|
3
|
+
* Fill in `deployment.adapter` and `deployment.site` from platform env vars
|
|
4
|
+
* (Vercel, Netlify, Cloudflare Pages) when the user hasn't set them. Explicit
|
|
5
|
+
* config always wins, and the adapter is only inferred for server output (it
|
|
6
|
+
* has no effect on static builds). Mirrors Astro's platform auto-detection so a
|
|
7
|
+
* project deployed to a known host gets a working canonical origin for free.
|
|
8
|
+
*/
|
|
9
|
+
export declare const applyDeploymentEnv: (config: ResolvedConfig, env?: NodeJS.ProcessEnv) => ResolvedConfig;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ZodError } from "zod";
|
|
2
|
+
import type { Diagnostic } from "./types.ts";
|
|
3
|
+
/** A recoverable error carrying a structured diagnostic. */
|
|
4
|
+
export declare class BlumeError extends Error {
|
|
5
|
+
readonly diagnostic: Diagnostic;
|
|
6
|
+
constructor(diagnostic: Diagnostic);
|
|
7
|
+
}
|
|
8
|
+
export declare const createDiagnostic: (diagnostic: Diagnostic) => Diagnostic;
|
|
9
|
+
/** Convert a ZodError into Blume diagnostics, anchored to a file. */
|
|
10
|
+
export declare const diagnosticsFromZod: (error: ZodError, options: {
|
|
11
|
+
code: string;
|
|
12
|
+
file?: string;
|
|
13
|
+
}) => Diagnostic[];
|
|
14
|
+
/** Format a single diagnostic for terminal output. */
|
|
15
|
+
export declare const formatDiagnostic: (diagnostic: Diagnostic, root?: string) => string;
|
|
16
|
+
export declare const hasErrors: (diagnostics: Diagnostic[]) => boolean;
|
|
17
|
+
export declare const countBySeverity: (diagnostics: Diagnostic[]) => Record<Diagnostic["severity"], number>;
|