@clarify-labs/cli 0.2.0 → 0.5.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.
@@ -2,7 +2,7 @@ import { Plugin } from 'vite';
2
2
  import { ResolvedProjectConfig, ContentRoute } from '../types.js';
3
3
  export declare function readIndexHtml(outputDirectory: string): string | undefined;
4
4
  export declare function injectSSRIntoTemplate(template: string, appHtml: string, projectConfig: ResolvedProjectConfig, route?: ContentRoute): string;
5
- export declare const SSR_ENTRY_CODE = "import { renderToHTML } from '@clarify-labs/renderer/server';\nimport { routes, navigation } from 'virtual:clarify-routes';\nimport { config } from 'virtual:clarify-config';\nimport { openApis } from 'virtual:clarify-openapi-registry';\n\nexport function render(url) {\n return renderToHTML({ config, routes, navigation, openApis, url });\n}";
5
+ export declare const SSR_ENTRY_CODE = "import { renderToHTML } from '@clarify-labs/renderer/server';\nimport { routes, navigation } from 'virtual:clarify-routes/server';\nimport { config } from 'virtual:clarify-config';\nimport { openApis } from 'virtual:clarify-openapi-registry';\n\nexport function render(url) {\n return renderToHTML({ config, routes, navigation, openApis, url });\n}";
6
6
  export declare function createTempEntryFile(content: string): string;
7
7
  export declare function buildSSRBundle(root: string, ssrEntry: string, ssrOutDir: string, plugins: Plugin[]): Promise<void>;
8
8
  export declare function renderSSGRoutes(routes: ContentRoute[], projectConfig: ResolvedProjectConfig, outputDirectory: string, ssrBundlePath: string, failOnError?: boolean): Promise<void>;
@@ -0,0 +1,52 @@
1
+ import { ClarifyThemeConfig, ResolvedClarifyThemeConfig } from '../types.js';
2
+ export declare const clarifyThemePresets: {
3
+ readonly default: {
4
+ readonly preset: "default";
5
+ readonly tokens: {
6
+ readonly colors: {
7
+ readonly primary: "#00D492";
8
+ readonly accent: "#00F6C9";
9
+ readonly background: "#ffffff";
10
+ readonly foreground: "#111827";
11
+ readonly surface: "#ffffff";
12
+ readonly muted: "#64748b";
13
+ readonly border: "rgb(15 23 42 / 0.12)";
14
+ readonly codeBackground: "#f7fefb";
15
+ };
16
+ readonly radius: {
17
+ readonly sm: "6px";
18
+ readonly md: "10px";
19
+ readonly lg: "14px";
20
+ readonly xl: "18px";
21
+ };
22
+ };
23
+ readonly layout: {
24
+ readonly maxWidth: "82rem";
25
+ };
26
+ };
27
+ readonly base: {
28
+ readonly preset: "base";
29
+ readonly tokens: {
30
+ readonly colors: {
31
+ readonly primary: "#18181b";
32
+ readonly accent: "#52525b";
33
+ readonly background: "#ffffff";
34
+ readonly foreground: "#18181b";
35
+ readonly surface: "#ffffff";
36
+ readonly muted: "#71717a";
37
+ readonly border: "rgb(24 24 27 / 0.12)";
38
+ readonly codeBackground: "#f4f4f5";
39
+ };
40
+ readonly radius: {
41
+ readonly sm: "6px";
42
+ readonly md: "8px";
43
+ readonly lg: "12px";
44
+ readonly xl: "16px";
45
+ };
46
+ };
47
+ readonly layout: {
48
+ readonly maxWidth: "80rem";
49
+ };
50
+ };
51
+ };
52
+ export declare function resolveThemeConfig(theme?: ClarifyThemeConfig): ResolvedClarifyThemeConfig;
@@ -1,18 +1,21 @@
1
- import { ClarifyPagesConfig, ContentRoute, NavigationTree, ResolvedBuildOptions, ResolvedProjectConfig } from '../types.js';
1
+ import { ContentRoute, NavigationTree, ResolvedBuildOptions, ResolvedProjectConfig } from '../types.js';
2
2
  export declare const VIRTUAL_CONFIG = "virtual:clarify-config";
3
3
  export declare const VIRTUAL_ROUTES = "virtual:clarify-routes";
4
+ export declare const VIRTUAL_SERVER_ROUTES = "virtual:clarify-routes/server";
4
5
  export declare const VIRTUAL_OPENAPI_REGISTRY = "virtual:clarify-openapi-registry";
5
6
  export declare const VIRTUAL_CLIENT_ENTRY = "virtual:clarify-entry-client";
6
7
  export declare const RESOLVED_CLIENT_ENTRY: string;
7
8
  export type VirtualModules = Map<string, string>;
8
- export declare function resolveVirtualId(id: string): string;
9
- export declare function stripVirtualPrefix(id: string): string;
10
- export declare function generateConfigModule(projectConfig: ResolvedProjectConfig, buildOptions: ResolvedBuildOptions): string;
11
- export declare function generateRoutesModule(routes: ContentRoute[], pagesConfig?: ClarifyPagesConfig, resolvedNavigation?: NavigationTree, projectConfig?: ResolvedProjectConfig): string;
12
- export declare function createClientEntryModule(): string;
13
- export declare function buildVirtualModules(args: {
9
+ type BuildVirtualModulesArgs = {
14
10
  projectConfig: ResolvedProjectConfig;
15
11
  generateOptions: ResolvedBuildOptions;
16
12
  routes: ContentRoute[];
17
13
  navigation?: NavigationTree;
18
- }): VirtualModules;
14
+ };
15
+ export declare function resolveVirtualId(id: string): string;
16
+ export declare function stripVirtualPrefix(id: string): string;
17
+ export declare function generateConfigModule(projectConfig: ResolvedProjectConfig, buildOptions: ResolvedBuildOptions): string;
18
+ export declare function generateRoutesModule(routes: ContentRoute[], resolvedNavigation?: NavigationTree, projectConfig?: ResolvedProjectConfig, mode?: 'client' | 'server'): string;
19
+ export declare function createClientEntryModule(): string;
20
+ export declare function buildVirtualModules(args: BuildVirtualModulesArgs): VirtualModules;
21
+ export {};
package/output/index.cjs CHANGED
@@ -1,4 +1,4 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_plugin = require("./plugin-CEyCiD5r.cjs");
2
+ const require_plugin = require("./plugin-DnD0L83F.cjs");
3
3
  exports.clarifyPlugin = require_plugin.clarifyPlugin;
4
4
  exports.defineConfig = require_plugin.defineConfig;
package/output/index.js CHANGED
@@ -1,2 +1,2 @@
1
- import { n as defineConfig, t as clarifyPlugin } from "./plugin-BUWojlPv.js";
1
+ import { n as defineConfig, t as clarifyPlugin } from "./plugin-PEEknlAO.js";
2
2
  export { clarifyPlugin, defineConfig };
@@ -1,5 +1,17 @@
1
+ export type ParsedFrontmatter = {
2
+ frontmatter: Record<string, unknown>;
3
+ content: string;
4
+ };
5
+ /**
6
+ * 在内容入口统一解析 MDX frontmatter,并返回可供后续流程复用的标准化正文。
7
+ */
8
+ export declare function parseFrontmatter(content: string): ParsedFrontmatter;
1
9
  /**
2
10
  * 从 MDX 文件内容中提取 frontmatter。
3
11
  * 使用 gray-matter 支持 YAML frontmatter 的标准语法和类型解析。
4
12
  */
5
13
  export declare function extractFrontmatter(content: string): Record<string, unknown>;
14
+ /**
15
+ * 移除 MDX 文件开头的 YAML frontmatter,保留页面正文。
16
+ */
17
+ export declare function stripFrontmatter(content: string): string;
@@ -1,4 +1,3 @@
1
- import { default as remarkGfm } from 'remark-gfm';
2
1
  type HastNode = {
3
2
  type: string;
4
3
  tagName?: string;
@@ -9,6 +8,6 @@ type HastNode = {
9
8
  export declare function rehypeParseCodeBlocks(): (tree: HastNode) => void;
10
9
  export declare function rehypeShiki(): (tree: HastNode) => Promise<void>;
11
10
  export declare function rehypeSlugSections(): (tree: HastNode) => void;
12
- export declare const remarkPlugins: (typeof remarkGfm)[];
11
+ export declare const remarkPlugins: typeof import('remark-gfm').default[];
13
12
  export declare const rehypePlugins: (typeof rehypeSlugSections)[];
14
13
  export {};
@@ -1,4 +1,4 @@
1
- import { ContentRoute, ContentSection, ClarifyNavigationNode, ClarifyPagesGroup, ClarifyLocalizedText, LocalizedNavigation, ResolvedClarifyI18nConfig } from '../types.js';
1
+ import { ContentRoute, ContentSection, ClarifyNavigationNode, ClarifyPagesConfig, ClarifyPagesGroup, ClarifyLocalizedText, ClarifyTabsConfig, LocalizedNavigation, LocalizedTabbedNavigation, ResolvedClarifyI18nConfig, TabbedNavigation } from '../types.js';
2
2
  /** 从 MDX/Markdown 内容中提取 H2/H3 章节 */
3
3
  export declare function extractMdxSections(content: string): ContentSection[];
4
4
  export declare function basePathFromRef(ref: string): string;
@@ -9,5 +9,7 @@ export declare function resolveLocalizedText(text: ClarifyLocalizedText | undefi
9
9
  export declare function findContentRoutes(dir: string, base?: string): ContentRoute[];
10
10
  export declare function findLocalizedContentRoutes(contentRoot: string, i18n?: ResolvedClarifyI18nConfig): ContentRoute[];
11
11
  export declare function buildNavigation(routes: ContentRoute[]): ClarifyNavigationNode[];
12
+ export declare function buildNavigationFromTabsConfig(routes: ContentRoute[], tabs: ClarifyTabsConfig): TabbedNavigation;
12
13
  export declare function buildNavigationFromConfig(routes: ContentRoute[], config: ClarifyPagesGroup[]): ClarifyNavigationNode[];
13
- export declare function buildLocalizedNavigation(routes: ContentRoute[], config: ClarifyPagesGroup[] | 'FileTree' | undefined, i18n?: ResolvedClarifyI18nConfig): LocalizedNavigation | undefined;
14
+ export declare function buildLocalizedNavigation(routes: ContentRoute[], config: ClarifyPagesConfig | undefined, i18n?: ResolvedClarifyI18nConfig): LocalizedNavigation | undefined;
15
+ export declare function buildLocalizedNavigationFromTabsConfig(routes: ContentRoute[], tabs: ClarifyTabsConfig, i18n?: ResolvedClarifyI18nConfig): LocalizedTabbedNavigation | undefined;
@@ -0,0 +1,3 @@
1
+ import { ContentRoute, ResolvedClarifyI18nConfig } from '../types.js';
2
+ export declare function mdxRoute(route: Omit<ContentRoute, 'kind'>): ContentRoute;
3
+ export declare const testI18n: ResolvedClarifyI18nConfig;