@clarify-labs/cli 0.1.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.
- package/LICENSE +661 -0
- package/bin/clarify.js +2 -0
- package/output/cli/commands/build.d.ts +2 -0
- package/output/cli/commands/dev.d.ts +2 -0
- package/output/cli/commands/init.d.ts +2 -0
- package/output/cli/index.d.ts +2 -0
- package/output/cli/options.d.ts +17 -0
- package/output/cli/package.d.ts +1 -0
- package/output/cli.cjs +187 -0
- package/output/cli.cjs.map +1 -0
- package/output/cli.js +187 -0
- package/output/cli.js.map +1 -0
- package/output/core/config-schema.d.ts +140 -0
- package/output/core/config.d.ts +3 -0
- package/output/core/hooks.d.ts +5 -0
- package/output/core/options.d.ts +24 -0
- package/output/core/plugin.d.ts +4 -0
- package/output/core/runtime-deps.d.ts +7 -0
- package/output/core/ssg.d.ts +8 -0
- package/output/core/user-config.d.ts +7 -0
- package/output/core/utils.d.ts +1 -0
- package/output/core/virtual-modules.d.ts +18 -0
- package/output/core/vite-config.d.ts +10 -0
- package/output/index.cjs +4 -0
- package/output/index.d.ts +5 -0
- package/output/index.js +2 -0
- package/output/parsers/frontmatter.d.ts +5 -0
- package/output/parsers/mdx.d.ts +14 -0
- package/output/parsers/routes.d.ts +13 -0
- package/output/plugin-BUWojlPv.js +1277 -0
- package/output/plugin-BUWojlPv.js.map +1 -0
- package/output/plugin-CEyCiD5r.cjs +1330 -0
- package/output/plugin-CEyCiD5r.cjs.map +1 -0
- package/output/plugins/content-artifacts/index.d.ts +2 -0
- package/output/plugins/content-artifacts/raw-content.d.ts +8 -0
- package/output/plugins/content-artifacts/server.d.ts +5 -0
- package/output/plugins/html-shell/index.d.ts +2 -0
- package/output/plugins/openapi/index.d.ts +2 -0
- package/output/plugins/openapi/parser.d.ts +5 -0
- package/output/plugins/openapi/virtual-modules.d.ts +4 -0
- package/output/types.d.ts +191 -0
- package/package.json +63 -0
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { AliasOptions } from 'vite';
|
|
2
|
+
/**
|
|
3
|
+
* Resolve Clarify's framework/runtime dependencies from the CLI package instead
|
|
4
|
+
* of from the user's documentation project. This keeps content-only projects
|
|
5
|
+
* free from React, renderer, and tsconfig requirements.
|
|
6
|
+
*/
|
|
7
|
+
export declare function createClarifyRuntimeAliases(): AliasOptions;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Plugin } from 'vite';
|
|
2
|
+
import { ResolvedProjectConfig, ContentRoute } from '../types.js';
|
|
3
|
+
export declare function readIndexHtml(outputDirectory: string): string | undefined;
|
|
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}";
|
|
6
|
+
export declare function createTempEntryFile(content: string): string;
|
|
7
|
+
export declare function buildSSRBundle(root: string, ssrEntry: string, ssrOutDir: string, plugins: Plugin[]): Promise<void>;
|
|
8
|
+
export declare function renderSSGRoutes(routes: ContentRoute[], projectConfig: ResolvedProjectConfig, outputDirectory: string, ssrBundlePath: string, failOnError?: boolean): Promise<void>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ConfigEnv } from 'vite';
|
|
2
|
+
import { ClarifyProjectConfig } from '../types.js';
|
|
3
|
+
import { ClarifyBuildOptions } from './options.js';
|
|
4
|
+
export type ClarifyConfig = ClarifyProjectConfig & Pick<ClarifyBuildOptions, 'plugins' | 'ssg'>;
|
|
5
|
+
export declare function defineConfig(config: ClarifyConfig): ClarifyConfig;
|
|
6
|
+
export declare function findClarifyConfigFile(root: string): string | undefined;
|
|
7
|
+
export declare function loadClarifyConfig(root: string, env: ConfigEnv): Promise<ClarifyConfig>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function escapeHtml(text: string): string;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ClarifyPagesConfig, ContentRoute, NavigationTree, ResolvedBuildOptions, ResolvedProjectConfig } from '../types.js';
|
|
2
|
+
export declare const VIRTUAL_CONFIG = "virtual:clarify-config";
|
|
3
|
+
export declare const VIRTUAL_ROUTES = "virtual:clarify-routes";
|
|
4
|
+
export declare const VIRTUAL_OPENAPI_REGISTRY = "virtual:clarify-openapi-registry";
|
|
5
|
+
export declare const VIRTUAL_CLIENT_ENTRY = "virtual:clarify-entry-client";
|
|
6
|
+
export declare const RESOLVED_CLIENT_ENTRY: string;
|
|
7
|
+
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: {
|
|
14
|
+
projectConfig: ResolvedProjectConfig;
|
|
15
|
+
generateOptions: ResolvedBuildOptions;
|
|
16
|
+
routes: ContentRoute[];
|
|
17
|
+
navigation?: NavigationTree;
|
|
18
|
+
}): VirtualModules;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ConfigEnv, InlineConfig } from 'vite';
|
|
2
|
+
export type ClarifyViteConfigOptions = {
|
|
3
|
+
root: string;
|
|
4
|
+
content: string;
|
|
5
|
+
output: string;
|
|
6
|
+
host?: string | boolean;
|
|
7
|
+
port?: number;
|
|
8
|
+
open?: boolean | string;
|
|
9
|
+
};
|
|
10
|
+
export declare function createViteConfig(options: ClarifyViteConfigOptions, env: ConfigEnv): Promise<InlineConfig>;
|
package/output/index.cjs
ADDED
package/output/index.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { default as remarkGfm } from 'remark-gfm';
|
|
2
|
+
type HastNode = {
|
|
3
|
+
type: string;
|
|
4
|
+
tagName?: string;
|
|
5
|
+
value?: string;
|
|
6
|
+
properties?: Record<string, unknown>;
|
|
7
|
+
children?: HastNode[];
|
|
8
|
+
};
|
|
9
|
+
export declare function rehypeParseCodeBlocks(): (tree: HastNode) => void;
|
|
10
|
+
export declare function rehypeShiki(): (tree: HastNode) => Promise<void>;
|
|
11
|
+
export declare function rehypeSlugSections(): (tree: HastNode) => void;
|
|
12
|
+
export declare const remarkPlugins: (typeof remarkGfm)[];
|
|
13
|
+
export declare const rehypePlugins: (typeof rehypeSlugSections)[];
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ContentRoute, ContentSection, ClarifyNavigationNode, ClarifyPagesGroup, ClarifyLocalizedText, LocalizedNavigation, ResolvedClarifyI18nConfig } from '../types.js';
|
|
2
|
+
/** 从 MDX/Markdown 内容中提取 H2/H3 章节 */
|
|
3
|
+
export declare function extractMdxSections(content: string): ContentSection[];
|
|
4
|
+
export declare function basePathFromRef(ref: string): string;
|
|
5
|
+
export declare function routePathFromRef(ref: string): string;
|
|
6
|
+
export declare function virtualModuleIdFromRef(ref: string): string;
|
|
7
|
+
export declare function localizedRoutePath(basePath: string, locale: string, i18n: ResolvedClarifyI18nConfig): string;
|
|
8
|
+
export declare function resolveLocalizedText(text: ClarifyLocalizedText | undefined, locale: string, fallbackLocale?: string): string | undefined;
|
|
9
|
+
export declare function findContentRoutes(dir: string, base?: string): ContentRoute[];
|
|
10
|
+
export declare function findLocalizedContentRoutes(contentRoot: string, i18n?: ResolvedClarifyI18nConfig): ContentRoute[];
|
|
11
|
+
export declare function buildNavigation(routes: ContentRoute[]): ClarifyNavigationNode[];
|
|
12
|
+
export declare function buildNavigationFromConfig(routes: ContentRoute[], config: ClarifyPagesGroup[]): ClarifyNavigationNode[];
|
|
13
|
+
export declare function buildLocalizedNavigation(routes: ContentRoute[], config: ClarifyPagesGroup[] | 'FileTree' | undefined, i18n?: ResolvedClarifyI18nConfig): LocalizedNavigation | undefined;
|