@clarify-labs/cli 0.7.1 → 0.8.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/output/cli.cjs +11 -3
- package/output/cli.cjs.map +1 -1
- package/output/cli.js +11 -3
- package/output/cli.js.map +1 -1
- package/output/core/config-schema.d.ts +7 -16
- package/output/core/env-types.d.ts +8 -0
- package/output/core/hooks.d.ts +3 -2
- package/output/core/plugin.d.ts +0 -1
- package/output/core/ssg.d.ts +1 -1
- package/output/core/virtual-modules.d.ts +29 -16
- package/output/index.cjs +1 -1
- package/output/index.d.ts +1 -0
- package/output/index.js +1 -1
- package/output/parsers/routes.d.ts +3 -1
- package/output/{plugin-DFpkIm9j.cjs → plugin-B7c0iHMy.cjs} +388 -180
- package/output/plugin-B7c0iHMy.cjs.map +1 -0
- package/output/{plugin-o1rP_gts.js → plugin-CcD5HeTN.js} +388 -180
- package/output/plugin-CcD5HeTN.js.map +1 -0
- package/output/plugins/content-artifacts/artifacts.d.ts +1 -3
- package/output/plugins/openapi/parser.d.ts +2 -0
- package/output/plugins/openapi/virtual-modules.d.ts +15 -3
- package/output/plugins/seo/artifacts.d.ts +0 -1
- package/output/types.d.ts +15 -7
- package/package.json +6 -3
- package/output/plugin-DFpkIm9j.cjs.map +0 -1
- package/output/plugin-o1rP_gts.js.map +0 -1
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ClarifyPlugin } from '../types.js';
|
|
2
|
+
export declare function generateClarifyEnvDts(_plugins: ClarifyPlugin[]): string;
|
|
3
|
+
/**
|
|
4
|
+
* Writes `clarify-env.d.ts` into the project root. Only rewrites when content
|
|
5
|
+
* changes to avoid triggering unnecessary file watchers, and never overwrites a
|
|
6
|
+
* user-authored file that does not carry the generated marker.
|
|
7
|
+
*/
|
|
8
|
+
export declare function writeClarifyEnvDts(projectRoot: string, plugins: ClarifyPlugin[]): void;
|
package/output/core/hooks.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ViteDevServer } from 'vite';
|
|
2
|
-
import { ClarifyHookContext, ClarifyHooks, ClarifyPlugin } from '../types.js';
|
|
3
|
-
export declare function runHooks<K extends Exclude<keyof ClarifyHooks, 'build:done' | 'dev:configureServer'>>(plugins: ClarifyPlugin[], hookName: K, input: Parameters<NonNullable<ClarifyHooks[K]>>[0], ctx: ClarifyHookContext): Promise<Parameters<NonNullable<ClarifyHooks[K]>>[0]>;
|
|
2
|
+
import { ClarifyEmitAsset, ClarifyHookContext, ClarifyHooks, ClarifyPlugin } from '../types.js';
|
|
3
|
+
export declare function runHooks<K extends Exclude<keyof ClarifyHooks, 'build:assets' | 'build:done' | 'dev:configureServer'>>(plugins: ClarifyPlugin[], hookName: K, input: Parameters<NonNullable<ClarifyHooks[K]>>[0], ctx: ClarifyHookContext): Promise<Parameters<NonNullable<ClarifyHooks[K]>>[0]>;
|
|
4
4
|
export declare function runDevConfigureServerHooks(plugins: ClarifyPlugin[], server: ViteDevServer, ctx: ClarifyHookContext): Promise<void>;
|
|
5
|
+
export declare function runBuildAssetsHooks(plugins: ClarifyPlugin[], ctx: ClarifyHookContext): Promise<ClarifyEmitAsset[]>;
|
|
5
6
|
export declare function runBuildDoneHooks(plugins: ClarifyPlugin[], ctx: ClarifyHookContext): Promise<void>;
|
package/output/core/plugin.d.ts
CHANGED
package/output/core/ssg.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ export declare function readIndexHtml(outputDirectory: string): string | undefin
|
|
|
4
4
|
export declare function injectSSRIntoTemplate(template: string, appHtml: string, projectConfig: ResolvedProjectConfig, route?: ContentRoute): string;
|
|
5
5
|
export declare function isNotFoundRoute(route: ContentRoute): boolean;
|
|
6
6
|
export declare function routeOutputFiles(outputDirectory: string, route: ContentRoute): string[];
|
|
7
|
-
export declare const SSR_ENTRY_CODE = "import { renderToHTML } from '@clarify-labs/renderer/server';\nimport { routes, navigation } from 'virtual:clarify
|
|
7
|
+
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';\nimport { runtimeSlots } from 'virtual:clarify/slots';\n\nexport async function render(url) {\n // Pre-resolve every slot component factory so renderToString can use\n // them synchronously (renderToString has no Suspense support).\n const entries = Object.values(runtimeSlots).flat()\n await Promise.all(entries.map(async (entry) => {\n const mod = await entry.component()\n entry._resolved = mod.default\n }))\n return renderToHTML({ config, routes, navigation, openApis, runtimeSlots, url, themeEditor: config.theme.editor });\n}";
|
|
8
8
|
export declare function createTempEntryFile(content: string): string;
|
|
9
9
|
export declare function buildSSRBundle(root: string, ssrEntry: string, ssrOutDir: string, plugins: Plugin[]): Promise<void>;
|
|
10
10
|
export declare function renderSSGRoutes(routes: ContentRoute[], projectConfig: ResolvedProjectConfig, outputDirectory: string, ssrBundlePath: string, failOnError?: boolean): Promise<void>;
|
|
@@ -1,25 +1,19 @@
|
|
|
1
|
-
import { ContentRoute, NavigationTree, ResolvedBuildOptions, ResolvedProjectConfig } from '../types.js';
|
|
2
|
-
export declare const VIRTUAL_CONFIG = "virtual:clarify
|
|
3
|
-
export declare const VIRTUAL_ROUTES = "virtual:clarify
|
|
4
|
-
export declare const VIRTUAL_SERVER_ROUTES = "virtual:clarify
|
|
5
|
-
export declare const
|
|
6
|
-
export declare const
|
|
1
|
+
import { ClarifyPlugin, 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_SERVER_ROUTES = "virtual:clarify/routes/server";
|
|
5
|
+
export declare const VIRTUAL_OPENAPI = "virtual:clarify/openapi";
|
|
6
|
+
export declare const VIRTUAL_SLOTS = "virtual:clarify/slots";
|
|
7
|
+
export declare const VIRTUAL_SLOT = "virtual:clarify/slot";
|
|
8
|
+
export declare const VIRTUAL_CLIENT_ENTRY = "virtual:clarify/entry-client";
|
|
7
9
|
export declare const RESOLVED_CLIENT_ENTRY: string;
|
|
8
10
|
export type VirtualModules = Map<string, string>;
|
|
9
|
-
type RuntimeImports = {
|
|
10
|
-
bannerComponent?: string;
|
|
11
|
-
footerComponent?: string;
|
|
12
|
-
};
|
|
13
|
-
type RuntimeModuleOptions = {
|
|
14
|
-
imports?: RuntimeImports;
|
|
15
|
-
bannerComponentSource?: 'path';
|
|
16
|
-
footerComponentSource?: 'path';
|
|
17
|
-
};
|
|
18
11
|
type BuildVirtualModulesArgs = {
|
|
19
12
|
projectConfig: ResolvedProjectConfig;
|
|
20
13
|
generateOptions: ResolvedBuildOptions;
|
|
21
14
|
routes: ContentRoute[];
|
|
22
15
|
navigation?: NavigationTree;
|
|
16
|
+
plugins?: ClarifyPlugin[];
|
|
23
17
|
themeEditor?: boolean;
|
|
24
18
|
};
|
|
25
19
|
type CreateClientEntryModuleOptions = {
|
|
@@ -29,7 +23,26 @@ export declare function resolveVirtualId(id: string): string;
|
|
|
29
23
|
export declare function stripVirtualPrefix(id: string): string;
|
|
30
24
|
export declare function generateConfigModule(projectConfig: ResolvedProjectConfig, buildOptions: ResolvedBuildOptions): string;
|
|
31
25
|
export declare function generateRoutesModule(routes: ContentRoute[], resolvedNavigation?: NavigationTree, projectConfig?: ResolvedProjectConfig, mode?: 'client' | 'server'): string;
|
|
32
|
-
export declare function createRuntimeModule(options?: RuntimeModuleOptions): string;
|
|
33
26
|
export declare function createClientEntryModule(options?: CreateClientEntryModuleOptions): string;
|
|
27
|
+
/**
|
|
28
|
+
* Collect every plugin's `slots` declarations into a single runtime registry
|
|
29
|
+
* module. Component modules are exported as lazy import factories so the
|
|
30
|
+
* renderer can decide whether to code-split (client) or pre-resolve (SSR).
|
|
31
|
+
*
|
|
32
|
+
* Relative component paths are resolved against the project `root` so that
|
|
33
|
+
* the generated `import()` call uses an absolute specifier — Vite cannot
|
|
34
|
+
* resolve relative imports from virtual modules.
|
|
35
|
+
*
|
|
36
|
+
* Slot name validity is enforced at compile time by the `UISlotName`
|
|
37
|
+
* type — no runtime validation is needed.
|
|
38
|
+
*/
|
|
39
|
+
export declare function createRuntimeSlotsModule(plugins?: ClarifyPlugin[], root?: string): string;
|
|
40
|
+
/**
|
|
41
|
+
* Re-exports the slot context hook from the renderer so plugin components can
|
|
42
|
+
* `import { useSlot } from 'virtual:clarify/slot'` without depending on
|
|
43
|
+
* renderer internals directly.
|
|
44
|
+
*/
|
|
45
|
+
export declare function createSlotModule(): string;
|
|
34
46
|
export declare function buildVirtualModules(args: BuildVirtualModulesArgs): VirtualModules;
|
|
47
|
+
export declare function generateOpenApiModule(): string;
|
|
35
48
|
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-
|
|
2
|
+
const require_plugin = require("./plugin-B7c0iHMy.cjs");
|
|
3
3
|
exports.clarifyPlugin = require_plugin.clarifyPlugin;
|
|
4
4
|
exports.defineConfig = require_plugin.defineConfig;
|
package/output/index.d.ts
CHANGED
|
@@ -3,3 +3,4 @@ export { defineConfig } from './core/user-config.js';
|
|
|
3
3
|
export type { Plugin } from 'vite';
|
|
4
4
|
export * from './types.js';
|
|
5
5
|
export type { ClarifyConfig } from './core/user-config.js';
|
|
6
|
+
export type { UISlotName, SlotContext, UISlotRegistration } from '@clarify-labs/renderer';
|
package/output/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as defineConfig, t as clarifyPlugin } from "./plugin-
|
|
1
|
+
import { n as defineConfig, t as clarifyPlugin } from "./plugin-CcD5HeTN.js";
|
|
2
2
|
export { clarifyPlugin, defineConfig };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ContentRoute, ContentSection, ClarifyNavigationNode, ClarifyPagesConfig, ClarifyPagesGroup, ClarifyLocalizedText, ClarifyTabsConfig, LocalizedNavigation, LocalizedTabbedNavigation, ResolvedClarifyI18nConfig, TabbedNavigation } from '../types.js';
|
|
2
|
+
export declare function kebabToTitle(str: string): string;
|
|
2
3
|
/** 从 MDX/Markdown 内容中提取 H2/H3 章节 */
|
|
3
4
|
export declare function extractMdxSections(content: string): ContentSection[];
|
|
4
5
|
export declare function normalizePath(path: string): string;
|
|
@@ -7,9 +8,10 @@ export declare function basePathFromRef(ref: string): string;
|
|
|
7
8
|
export declare function openAPIPagePathFromRef(ref: string, tagFilter?: string[], explicitPath?: string): string;
|
|
8
9
|
export declare function routePathFromRef(ref: string, explicitPath?: string): string;
|
|
9
10
|
export declare function virtualModuleIdFromRef(ref: string): string;
|
|
10
|
-
export declare function localizedRoutePath(basePath: string, locale: string,
|
|
11
|
+
export declare function localizedRoutePath(basePath: string, locale: string, _i18n: ResolvedClarifyI18nConfig): string;
|
|
11
12
|
export declare function resolveLocalizedText(text: ClarifyLocalizedText | undefined, locale: string, fallbackLocale?: string): string | undefined;
|
|
12
13
|
export declare function findContentRoutes(dir: string, base?: string): ContentRoute[];
|
|
14
|
+
export declare function withAlternates(route: ContentRoute, routes: ContentRoute[], i18n: ResolvedClarifyI18nConfig): ContentRoute;
|
|
13
15
|
export declare function findLocalizedContentRoutes(contentRoot: string, i18n?: ResolvedClarifyI18nConfig): ContentRoute[];
|
|
14
16
|
export declare function buildNavigation(routes: ContentRoute[]): ClarifyNavigationNode[];
|
|
15
17
|
export declare function applyConfiguredPageRoutePaths(routes: ContentRoute[], tabs?: ClarifyTabsConfig, i18n?: ResolvedClarifyI18nConfig): ContentRoute[];
|