@clarify-labs/cli 0.11.7 → 0.11.8
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 +6 -0
- package/output/core/runtime/ssg.d.ts +1 -1
- package/output/core/runtime/virtual-modules.d.ts +2 -5
- package/output/{engine-Cc7Ve6o-.js → engine-B_0YOc2B.js} +38 -16
- package/output/engine-B_0YOc2B.js.map +1 -0
- package/output/{engine-BbQJ97Ed.cjs → engine-pubnVIwZ.cjs} +38 -16
- package/output/engine-pubnVIwZ.cjs.map +1 -0
- package/output/index.cjs +1 -1
- package/output/index.js +1 -1
- package/output/types.d.ts +7 -0
- package/package.json +3 -3
- package/output/engine-BbQJ97Ed.cjs.map +0 -1
- package/output/engine-Cc7Ve6o-.js.map +0 -1
|
@@ -1014,6 +1014,22 @@ var clarifyVariableValueSchema = zod.z.lazy(() => zod.z.union([
|
|
|
1014
1014
|
zod.z.record(zod.z.string(), clarifyVariableValueSchema)
|
|
1015
1015
|
]));
|
|
1016
1016
|
var clarifyVariablesConfigSchema = zod.z.record(zod.z.string(), clarifyVariableValueSchema);
|
|
1017
|
+
var clarifySiteUrlSchema = zod.z.string().superRefine((value, ctx) => {
|
|
1018
|
+
let url;
|
|
1019
|
+
try {
|
|
1020
|
+
url = new URL(value);
|
|
1021
|
+
} catch {
|
|
1022
|
+
ctx.addIssue({
|
|
1023
|
+
code: zod.z.ZodIssueCode.custom,
|
|
1024
|
+
message: "must be an absolute HTTP(S) origin"
|
|
1025
|
+
});
|
|
1026
|
+
return;
|
|
1027
|
+
}
|
|
1028
|
+
if (!["http:", "https:"].includes(url.protocol) || url.username || url.password || url.pathname !== "/" || url.search || url.hash) ctx.addIssue({
|
|
1029
|
+
code: zod.z.ZodIssueCode.custom,
|
|
1030
|
+
message: "must be an HTTP(S) origin without a path, query, or hash; configure deployment subpaths with routePrefix"
|
|
1031
|
+
});
|
|
1032
|
+
});
|
|
1017
1033
|
var clarifyRepositoryConfigSchema = zod.z.object({
|
|
1018
1034
|
url: zod.z.string().optional(),
|
|
1019
1035
|
branch: zod.z.string().optional(),
|
|
@@ -1081,6 +1097,7 @@ var clarifyThemeConfigSchema = zod.z.object({
|
|
|
1081
1097
|
tokens: clarifyThemeTokensConfigSchema.optional(),
|
|
1082
1098
|
layout: clarifyThemeLayoutConfigSchema.optional()
|
|
1083
1099
|
}).strict();
|
|
1100
|
+
var clarifyLayoutConfigSchema = zod.z.object({ tabs: zod.z.enum(["subnav", "navbar"]).optional() }).strict();
|
|
1084
1101
|
function featureSchema(shape, defaults, enabledByDefault = true) {
|
|
1085
1102
|
const resolvedDefaults = {
|
|
1086
1103
|
enabled: enabledByDefault,
|
|
@@ -1104,13 +1121,14 @@ var clarifyFeaturesConfigSchema = zod.z.object({
|
|
|
1104
1121
|
var clarifyProjectConfigSchema = zod.z.object({
|
|
1105
1122
|
title: zod.z.string().optional(),
|
|
1106
1123
|
description: zod.z.string().optional(),
|
|
1107
|
-
siteUrl:
|
|
1124
|
+
siteUrl: clarifySiteUrlSchema.optional(),
|
|
1108
1125
|
routePrefix: zod.z.string().default("/"),
|
|
1109
1126
|
assetPrefix: zod.z.string().optional(),
|
|
1110
1127
|
logo: clarifyLogoConfigSchema.optional(),
|
|
1111
1128
|
homeUrl: zod.z.string().optional(),
|
|
1112
1129
|
favicon: clarifyFaviconConfigSchema.optional(),
|
|
1113
1130
|
theme: clarifyThemeConfigSchema.optional(),
|
|
1131
|
+
layout: clarifyLayoutConfigSchema.optional(),
|
|
1114
1132
|
navigation: zod.z.object({
|
|
1115
1133
|
links: zod.z.array(clarifyNavbarLinkSchema).optional(),
|
|
1116
1134
|
tabs: clarifyTabsConfigSchema.optional()
|
|
@@ -1182,6 +1200,7 @@ function resolveProjectConfig(config = {}) {
|
|
|
1182
1200
|
homeUrl: config.homeUrl,
|
|
1183
1201
|
favicon: config.favicon,
|
|
1184
1202
|
theme: resolveThemeConfig(config.theme),
|
|
1203
|
+
layout: { tabs: config.layout?.tabs ?? "subnav" },
|
|
1185
1204
|
navigation: config.navigation,
|
|
1186
1205
|
banner: config.banner,
|
|
1187
1206
|
footer: config.footer,
|
|
@@ -1326,7 +1345,7 @@ function resolveVirtualModuleId(id, modules, routes) {
|
|
|
1326
1345
|
if (route) return resolveVirtualId(route.module.pageVirtualModuleId);
|
|
1327
1346
|
return null;
|
|
1328
1347
|
}
|
|
1329
|
-
function generateConfigModule(projectConfig, version) {
|
|
1348
|
+
function generateConfigModule(projectConfig, version, themeEditor = false) {
|
|
1330
1349
|
const runtimeConfig = {
|
|
1331
1350
|
title: projectConfig.title,
|
|
1332
1351
|
description: projectConfig.description,
|
|
@@ -1337,6 +1356,7 @@ function generateConfigModule(projectConfig, version) {
|
|
|
1337
1356
|
homeUrl: projectConfig.homeUrl,
|
|
1338
1357
|
favicon: projectConfig.favicon,
|
|
1339
1358
|
theme: projectConfig.theme,
|
|
1359
|
+
layout: projectConfig.layout,
|
|
1340
1360
|
navigation: projectConfig.navigation,
|
|
1341
1361
|
banner: projectConfig.banner,
|
|
1342
1362
|
footer: projectConfig.footer,
|
|
@@ -1345,7 +1365,7 @@ function generateConfigModule(projectConfig, version) {
|
|
|
1345
1365
|
features: projectConfig.features
|
|
1346
1366
|
};
|
|
1347
1367
|
if (version) runtimeConfig.version = version;
|
|
1348
|
-
return `export const config = ${JSON.stringify(runtimeConfig)};`;
|
|
1368
|
+
return `export const config = ${JSON.stringify(runtimeConfig)};\nexport const runtime = ${JSON.stringify({ themeEditor })};`;
|
|
1349
1369
|
}
|
|
1350
1370
|
function moduleSpecifier(value) {
|
|
1351
1371
|
return JSON.stringify(value);
|
|
@@ -1384,15 +1404,15 @@ function generateRoutesModule(routes, navigation, mode = "client") {
|
|
|
1384
1404
|
return ` ${JSON.stringify(manifestEntry, null, 0).replace(`"${placeholder}"`, component).replace(/"([A-Za-z_$][\w$]*)":/g, "$1: ")}`;
|
|
1385
1405
|
}).join(",\n")}\n];\n\nexport const navigation = ${JSON.stringify(navigation, null, 2)};\n`;
|
|
1386
1406
|
}
|
|
1387
|
-
function createClientEntryModule(
|
|
1407
|
+
function createClientEntryModule() {
|
|
1388
1408
|
return `
|
|
1389
1409
|
import '@clarify-labs/renderer/style.css';
|
|
1390
1410
|
import { render } from '@clarify-labs/renderer/client';
|
|
1391
1411
|
import { routes, navigation } from '${VIRTUAL_ROUTES}';
|
|
1392
|
-
import { config } from '${VIRTUAL_CONFIG}';
|
|
1412
|
+
import { config, runtime } from '${VIRTUAL_CONFIG}';
|
|
1393
1413
|
import { openApiSpecs } from '${VIRTUAL_OPENAPI}';
|
|
1394
1414
|
import { runtimeSlots } from '${VIRTUAL_SLOTS}';
|
|
1395
|
-
const renderOptions = { config, routes, navigation, openApiSpecs, runtimeSlots, themeEditor:
|
|
1415
|
+
const renderOptions = { config, routes, navigation, openApiSpecs, runtimeSlots, themeEditor: runtime.themeEditor };
|
|
1396
1416
|
render(renderOptions);
|
|
1397
1417
|
if (import.meta.hot) {
|
|
1398
1418
|
import.meta.hot.accept('${VIRTUAL_ROUTES}', (mod) => {
|
|
@@ -1444,9 +1464,9 @@ export default createContentDiagnosticComponent(contentDiagnostic);
|
|
|
1444
1464
|
}
|
|
1445
1465
|
function buildVirtualModules(args) {
|
|
1446
1466
|
const modules = /* @__PURE__ */ new Map();
|
|
1447
|
-
const clientEntryModule = createClientEntryModule(
|
|
1467
|
+
const clientEntryModule = createClientEntryModule();
|
|
1448
1468
|
const allPlugins = [...args.plugins ?? []];
|
|
1449
|
-
modules.set(VIRTUAL_CONFIG, generateConfigModule(args.projectConfig, args.version));
|
|
1469
|
+
modules.set(VIRTUAL_CONFIG, generateConfigModule(args.projectConfig, args.version, args.themeEditor));
|
|
1450
1470
|
modules.set(VIRTUAL_ROUTES, generateRoutesModule(args.routes, args.navigation, "client"));
|
|
1451
1471
|
modules.set(VIRTUAL_SERVER_ROUTES, generateRoutesModule(args.routes, args.navigation, "server"));
|
|
1452
1472
|
modules.set(VIRTUAL_SLOTS, createRuntimeSlotsModule(allPlugins, args.generateOptions.projectRoot));
|
|
@@ -1691,7 +1711,7 @@ function createViteAdapter(engine) {
|
|
|
1691
1711
|
}
|
|
1692
1712
|
var cliPackageVersion = {
|
|
1693
1713
|
name: "@clarify-labs/cli",
|
|
1694
|
-
version: "0.11.
|
|
1714
|
+
version: "0.11.8",
|
|
1695
1715
|
license: "AGPL-3.0-only",
|
|
1696
1716
|
type: "module",
|
|
1697
1717
|
repository: {
|
|
@@ -1899,7 +1919,8 @@ function normalizeRoutePrefix$1(routePrefix) {
|
|
|
1899
1919
|
function resolveContentArtifactPath(url, projectConfig) {
|
|
1900
1920
|
const requestPath = url?.split("?")[0] ?? "";
|
|
1901
1921
|
const basePath = normalizeRoutePrefix$1(projectConfig.routePrefix);
|
|
1902
|
-
|
|
1922
|
+
const hasBasePath = requestPath === basePath || requestPath.startsWith(`${basePath}/`);
|
|
1923
|
+
return basePath && hasBasePath ? requestPath.slice(basePath.length) || "/" : requestPath;
|
|
1903
1924
|
}
|
|
1904
1925
|
function resolveContentArtifactType(route) {
|
|
1905
1926
|
return route.kind === "openapi" ? "application/json; charset=utf-8" : "text/markdown; charset=utf-8";
|
|
@@ -2799,15 +2820,16 @@ function createOpenAPIPlugin() {
|
|
|
2799
2820
|
return {
|
|
2800
2821
|
name: "clarify:openapi",
|
|
2801
2822
|
hooks: {
|
|
2802
|
-
"routes:discover": (input, ctx) =>
|
|
2823
|
+
"routes:discover": (input, ctx) => ctx.projectConfig.features.openapi.enabled ? {
|
|
2803
2824
|
...input,
|
|
2804
2825
|
routes: [...input.routes, ...discoverOpenAPIRoutes(input.contentRoot, ctx.projectConfig.locales)]
|
|
2805
|
-
}
|
|
2826
|
+
} : input,
|
|
2806
2827
|
"routes:discovered": async (routes, ctx) => {
|
|
2828
|
+
if (!ctx.projectConfig.features.openapi.enabled) return state.enrichRoutes(routes.filter((route) => route.kind !== "openapi"), ctx);
|
|
2807
2829
|
const expandedRoutes = expandConfiguredOpenAPIRoutes(routes, ctx.projectConfig);
|
|
2808
2830
|
return state.enrichRoutes(expandedRoutes, ctx);
|
|
2809
2831
|
},
|
|
2810
|
-
"modules:before": (modules, ctx) => state.contributeModules(modules, ctx.routes)
|
|
2832
|
+
"modules:before": (modules, ctx) => state.contributeModules(modules, ctx.projectConfig.features.openapi.enabled ? ctx.routes : ctx.routes.filter((route) => route.kind !== "openapi"))
|
|
2811
2833
|
}
|
|
2812
2834
|
};
|
|
2813
2835
|
}
|
|
@@ -3569,7 +3591,7 @@ function routeOutputFiles(outputDirectory, route) {
|
|
|
3569
3591
|
}
|
|
3570
3592
|
var SSR_ENTRY_CODE = `import { renderToHTML } from '@clarify-labs/renderer/server';
|
|
3571
3593
|
import { routes, navigation } from 'virtual:clarify/routes/server';
|
|
3572
|
-
import { config } from 'virtual:clarify/config';
|
|
3594
|
+
import { config, runtime } from 'virtual:clarify/config';
|
|
3573
3595
|
import { openApiSpecs } from 'virtual:clarify/openapi/server';
|
|
3574
3596
|
import { runtimeSlots } from 'virtual:clarify/slots';
|
|
3575
3597
|
|
|
@@ -3581,7 +3603,7 @@ export async function render(url) {
|
|
|
3581
3603
|
const mod = await entry.loadComponent()
|
|
3582
3604
|
entry._resolved = mod.default
|
|
3583
3605
|
}))
|
|
3584
|
-
return renderToHTML({ config, routes, navigation, openApiSpecs, runtimeSlots, url, themeEditor:
|
|
3606
|
+
return renderToHTML({ config, routes, navigation, openApiSpecs, runtimeSlots, url, themeEditor: runtime.themeEditor });
|
|
3585
3607
|
}`;
|
|
3586
3608
|
function createTempEntryFile(content) {
|
|
3587
3609
|
const entryPath = (0, node_path.join)(createClarifyTempDir("ssr"), "entry-server.ts");
|
|
@@ -4095,4 +4117,4 @@ Object.defineProperty(exports, "searchMcpIndex", {
|
|
|
4095
4117
|
}
|
|
4096
4118
|
});
|
|
4097
4119
|
|
|
4098
|
-
//# sourceMappingURL=engine-
|
|
4120
|
+
//# sourceMappingURL=engine-pubnVIwZ.cjs.map
|