@clarify-labs/cli 0.11.15 → 0.11.17
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 +1 -1
- package/output/cli.js +1 -1
- package/output/core/config/config-schema.d.ts +2 -2
- package/output/{engine-DQ_RfLxa.cjs → engine-BNvizszh.cjs} +6 -68
- package/output/engine-BNvizszh.cjs.map +1 -0
- package/output/{engine-DMfwsN-k.js → engine-CIhcMyvD.js} +6 -68
- package/output/engine-CIhcMyvD.js.map +1 -0
- package/output/index.cjs +1 -1
- package/output/index.js +1 -1
- package/output/plugins/content-artifacts/artifacts.d.ts +1 -2
- package/package.json +3 -3
- package/output/engine-DMfwsN-k.js.map +0 -1
- package/output/engine-DQ_RfLxa.cjs.map +0 -1
package/output/cli.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
const require_engine = require("./engine-
|
|
2
|
+
const require_engine = require("./engine-BNvizszh.cjs");
|
|
3
3
|
let node_path = require("node:path");
|
|
4
4
|
let node_fs_promises = require("node:fs/promises");
|
|
5
5
|
let node_child_process = require("node:child_process");
|
package/output/cli.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { a as createClarifyTempDir, c as cliPackageVersion, d as createViteAdapter, i as findRouteConflicts, l as cliPackageVersionWithCaret, n as createClarifyEngine, o as deserializeSearchIndex, r as createClarifyRuntimeAliases, s as searchMcpIndex, u as printCliVersion } from "./engine-
|
|
2
|
+
import { a as createClarifyTempDir, c as cliPackageVersion, d as createViteAdapter, i as findRouteConflicts, l as cliPackageVersionWithCaret, n as createClarifyEngine, o as deserializeSearchIndex, r as createClarifyRuntimeAliases, s as searchMcpIndex, u as printCliVersion } from "./engine-CIhcMyvD.js";
|
|
3
3
|
import { dirname, extname, isAbsolute, join, normalize, relative, resolve } from "node:path";
|
|
4
4
|
import { lstat, mkdir, readFile, stat, writeFile } from "node:fs/promises";
|
|
5
5
|
import { spawnSync } from "node:child_process";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { ClarifyNavbarMenuItem,
|
|
2
|
+
import { ClarifyNavbarMenuItem, ClarifyVariableValue } from '../../types.js';
|
|
3
3
|
export declare const clarifyFeaturesConfigSchema: z.ZodObject<{
|
|
4
4
|
search: z.ZodPipe<z.ZodDefault<z.ZodUnion<readonly [z.ZodBoolean, z.ZodDefault<z.ZodObject<{
|
|
5
5
|
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
@@ -130,7 +130,7 @@ export declare const clarifyProjectConfigSchema: z.ZodObject<{
|
|
|
130
130
|
tabs: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
131
131
|
tab: z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>]>;
|
|
132
132
|
icon: z.ZodOptional<z.ZodString>;
|
|
133
|
-
pages: z.ZodOptional<z.ZodUnion<readonly [z.ZodArray<z.ZodType<ClarifyPagesGroup, ClarifyPagesGroup, z.core.$ZodTypeInternals<ClarifyPagesGroup, ClarifyPagesGroup>>>, z.ZodLiteral<"FileTree">]>>;
|
|
133
|
+
pages: z.ZodOptional<z.ZodUnion<readonly [z.ZodArray<z.ZodType<import('../../types.js').ClarifyPagesGroup, import('../../types.js').ClarifyPagesGroup, z.core.$ZodTypeInternals<import('../../types.js').ClarifyPagesGroup, import('../../types.js').ClarifyPagesGroup>>>, z.ZodLiteral<"FileTree">]>>;
|
|
134
134
|
}, z.core.$strict>>>;
|
|
135
135
|
}, z.core.$strict>>;
|
|
136
136
|
banner: z.ZodOptional<z.ZodObject<{
|
|
@@ -1149,7 +1149,7 @@ var clarifyPagesItemSchema = zod.z.lazy(() => zod.z.union([
|
|
|
1149
1149
|
filter: zod.z.object({ tags: zod.z.array(zod.z.string()).optional() }).strict().optional()
|
|
1150
1150
|
}).strict()
|
|
1151
1151
|
]));
|
|
1152
|
-
var
|
|
1152
|
+
var clarifyPagesGroupSchema = zod.z.lazy(() => zod.z.object({
|
|
1153
1153
|
group: clarifyLocalizedTextSchema,
|
|
1154
1154
|
icon: zod.z.string().optional(),
|
|
1155
1155
|
visible: zod.z.enum([
|
|
@@ -1160,8 +1160,7 @@ var clarifyPagesGroupShape = {
|
|
|
1160
1160
|
searchable: zod.z.boolean().optional(),
|
|
1161
1161
|
layout: zod.z.enum(["documentation", "blog"]).optional(),
|
|
1162
1162
|
pages: zod.z.array(clarifyPagesItemSchema)
|
|
1163
|
-
};
|
|
1164
|
-
var clarifyPagesGroupSchema = zod.z.lazy(() => zod.z.object(clarifyPagesGroupShape).strict());
|
|
1163
|
+
}).strict());
|
|
1165
1164
|
var clarifyPagesConfigSchema = zod.z.union([zod.z.array(clarifyPagesGroupSchema), zod.z.literal("FileTree")]);
|
|
1166
1165
|
var clarifyTabItemSchema = zod.z.object({
|
|
1167
1166
|
tab: clarifyLocalizedTextSchema,
|
|
@@ -1820,7 +1819,7 @@ function createViteAdapter(engine) {
|
|
|
1820
1819
|
}
|
|
1821
1820
|
var cliPackageVersion = {
|
|
1822
1821
|
name: "@clarify-labs/cli",
|
|
1823
|
-
version: "0.11.
|
|
1822
|
+
version: "0.11.17",
|
|
1824
1823
|
license: "AGPL-3.0-only",
|
|
1825
1824
|
type: "module",
|
|
1826
1825
|
repository: {
|
|
@@ -1946,49 +1945,6 @@ function readRouteArtifactContent(route) {
|
|
|
1946
1945
|
const content = readRouteContent(route);
|
|
1947
1946
|
return shouldUseUtf8Signature(route) ? withUtf8Signature(content) : content;
|
|
1948
1947
|
}
|
|
1949
|
-
function mergeOpenAPIRecord(target, source, section, filePath) {
|
|
1950
|
-
if (!source) return;
|
|
1951
|
-
for (const [key, value] of Object.entries(source)) {
|
|
1952
|
-
const existing = target[key];
|
|
1953
|
-
if (existing !== void 0 && JSON.stringify(existing) !== JSON.stringify(value)) throw new Error(`[clarify] Cannot aggregate OpenAPI specs: conflicting ${section} entry "${key}" in ${filePath}.`);
|
|
1954
|
-
target[key] = value;
|
|
1955
|
-
}
|
|
1956
|
-
}
|
|
1957
|
-
function createRootOpenAPISpec(routes, projectConfig) {
|
|
1958
|
-
const paths = {};
|
|
1959
|
-
const webhooks = {};
|
|
1960
|
-
const components = {};
|
|
1961
|
-
const tags = /* @__PURE__ */ new Map();
|
|
1962
|
-
const defaultLocale = projectConfig.locales?.default;
|
|
1963
|
-
for (const route of routes) {
|
|
1964
|
-
if (route.kind !== "openapi" || route.diagnostic || !route.source.content || defaultLocale && route.locale && route.locale !== defaultLocale) continue;
|
|
1965
|
-
const filePath = route.source.filePath;
|
|
1966
|
-
const spec = JSON.parse(route.source.content);
|
|
1967
|
-
mergeOpenAPIRecord(paths, spec.paths, "paths", filePath);
|
|
1968
|
-
mergeOpenAPIRecord(webhooks, "webhooks" in spec ? spec.webhooks : void 0, "webhooks", filePath);
|
|
1969
|
-
for (const [section, entries] of Object.entries(spec.components ?? {})) {
|
|
1970
|
-
components[section] ??= {};
|
|
1971
|
-
mergeOpenAPIRecord(components[section], entries, `components.${section}`, filePath);
|
|
1972
|
-
}
|
|
1973
|
-
for (const tag of spec.tags ?? []) {
|
|
1974
|
-
const existing = tags.get(tag.name);
|
|
1975
|
-
if (existing !== void 0 && JSON.stringify(existing) !== JSON.stringify(tag)) throw new Error(`[clarify] Cannot aggregate OpenAPI specs: conflicting tag "${tag.name}" in ${filePath}.`);
|
|
1976
|
-
tags.set(tag.name, tag);
|
|
1977
|
-
}
|
|
1978
|
-
}
|
|
1979
|
-
return {
|
|
1980
|
-
openapi: "3.1.0",
|
|
1981
|
-
info: {
|
|
1982
|
-
title: projectConfig.title,
|
|
1983
|
-
description: projectConfig.description,
|
|
1984
|
-
version: "1.0.0"
|
|
1985
|
-
},
|
|
1986
|
-
paths,
|
|
1987
|
-
...Object.keys(webhooks).length > 0 ? { webhooks } : {},
|
|
1988
|
-
...Object.keys(components).length > 0 ? { components } : {},
|
|
1989
|
-
...tags.size > 0 ? { tags: [...tags.values()] } : {}
|
|
1990
|
-
};
|
|
1991
|
-
}
|
|
1992
1948
|
function isLlmsTxtRoute(route) {
|
|
1993
1949
|
return !route.path.split("/").includes("404");
|
|
1994
1950
|
}
|
|
@@ -2088,14 +2044,6 @@ function serveContentArtifacts(req, res, projectConfig, routes) {
|
|
|
2088
2044
|
res.end(createLlmsTxtArtifact(routes, projectConfig), "utf8");
|
|
2089
2045
|
return true;
|
|
2090
2046
|
}
|
|
2091
|
-
if (contentPath === "/openapi.json" || contentPath === "/openapi.yml") {
|
|
2092
|
-
const spec = createRootOpenAPISpec(routes, projectConfig);
|
|
2093
|
-
const isJson = contentPath.endsWith(".json");
|
|
2094
|
-
res.statusCode = 200;
|
|
2095
|
-
res.setHeader("Content-Type", isJson ? "application/json; charset=utf-8" : "text/yaml; charset=utf-8");
|
|
2096
|
-
res.end(isJson ? JSON.stringify(spec, null, 2) : (0, yaml.stringify)(spec, { lineWidth: 0 }), "utf8");
|
|
2097
|
-
return true;
|
|
2098
|
-
}
|
|
2099
2047
|
if (contentPath.endsWith(".openapi.yaml")) {
|
|
2100
2048
|
const jsonPath = contentPath.replace(/\.yaml$/, ".json");
|
|
2101
2049
|
const route = routes.find((route) => route.artifacts?.contentArtifactUrl === jsonPath);
|
|
@@ -2155,14 +2103,6 @@ function createContentArtifactsPlugin() {
|
|
|
2155
2103
|
fileName: "llms.txt",
|
|
2156
2104
|
source: createLlmsTxtArtifact(ctx.routes, ctx.projectConfig)
|
|
2157
2105
|
});
|
|
2158
|
-
const rootOpenAPISpec = createRootOpenAPISpec(ctx.routes, ctx.projectConfig);
|
|
2159
|
-
assets.push({
|
|
2160
|
-
fileName: "openapi.json",
|
|
2161
|
-
source: JSON.stringify(rootOpenAPISpec, null, 2)
|
|
2162
|
-
}, {
|
|
2163
|
-
fileName: "openapi.yml",
|
|
2164
|
-
source: (0, yaml.stringify)(rootOpenAPISpec, { lineWidth: 0 })
|
|
2165
|
-
});
|
|
2166
2106
|
return assets;
|
|
2167
2107
|
}
|
|
2168
2108
|
}
|
|
@@ -4207,8 +4147,7 @@ var ClarifyEngine = class {
|
|
|
4207
4147
|
assertNoContentDiagnostics(this.routes);
|
|
4208
4148
|
const outputDir = this.runtime.outputDirectory ?? this.generateOptions.outputDirectory;
|
|
4209
4149
|
if (!outputDir) throw new Error("[clarify] outputDirectory is required before SSG runs");
|
|
4210
|
-
const
|
|
4211
|
-
const ssrOutputDir = createClarifyTempDir("ssr-output");
|
|
4150
|
+
const ssrOutputDir = (0, node_path.join)(outputDir, ".ssr");
|
|
4212
4151
|
let tempEntryPath;
|
|
4213
4152
|
try {
|
|
4214
4153
|
tempEntryPath = createTempEntryFile(SSR_ENTRY_CODE);
|
|
@@ -4219,12 +4158,11 @@ var ClarifyEngine = class {
|
|
|
4219
4158
|
plugins: this.runtime.ssrPlugins ?? []
|
|
4220
4159
|
});
|
|
4221
4160
|
const ssrBundlePath = (0, node_path.join)(ssrOutputDir, "entry-server.js");
|
|
4222
|
-
await renderSSGRoutes(this.routes, this.runtimeContext(),
|
|
4161
|
+
await renderSSGRoutes(this.routes, this.runtimeContext(), outputDir, ssrBundlePath);
|
|
4223
4162
|
} catch (err) {
|
|
4224
4163
|
console.error("[clarify] SSG failed:", err);
|
|
4225
4164
|
throw err;
|
|
4226
4165
|
} finally {
|
|
4227
|
-
removeClarifyTempDir(ssrOutputDir);
|
|
4228
4166
|
if (tempEntryPath) try {
|
|
4229
4167
|
(0, node_fs.rmSync)(tempEntryPath, { force: true });
|
|
4230
4168
|
} catch {}
|
|
@@ -4338,4 +4276,4 @@ Object.defineProperty(exports, "searchMcpIndex", {
|
|
|
4338
4276
|
}
|
|
4339
4277
|
});
|
|
4340
4278
|
|
|
4341
|
-
//# sourceMappingURL=engine-
|
|
4279
|
+
//# sourceMappingURL=engine-BNvizszh.cjs.map
|