@unterberg/nivel 0.2.0 → 0.2.2

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.
Files changed (41) hide show
  1. package/README.md +2 -1
  2. package/dist/{chunk-SOVTSE5J.js → chunk-AT4O3RRN.js} +8 -2
  3. package/dist/chunk-AT4O3RRN.js.map +1 -0
  4. package/dist/{chunk-VGBPF5O7.js → chunk-C724XH47.js} +3 -5
  5. package/dist/chunk-C724XH47.js.map +1 -0
  6. package/dist/{chunk-WEGYZIYX.js → chunk-H4A5UBJ5.js} +2 -2
  7. package/dist/{chunk-G6PC37P5.js → chunk-IEWXVGSC.js} +522 -8
  8. package/dist/chunk-IEWXVGSC.js.map +1 -0
  9. package/dist/{chunk-MPERUGQD.js → chunk-KZMOVRDK.js} +80 -56
  10. package/dist/chunk-KZMOVRDK.js.map +1 -0
  11. package/dist/chunk-WMHFKLPG.js +124 -0
  12. package/dist/chunk-WMHFKLPG.js.map +1 -0
  13. package/dist/cli.js +2 -3
  14. package/dist/cli.js.map +1 -1
  15. package/dist/client.d.ts +1 -1
  16. package/dist/client.js +3 -4
  17. package/dist/icons.d.ts +1 -1
  18. package/dist/icons.js +11637 -2
  19. package/dist/icons.js.map +1 -1
  20. package/dist/index.d.ts +1 -1
  21. package/dist/index.js +2 -3
  22. package/dist/mdx.js +2 -3
  23. package/dist/mdx.js.map +1 -1
  24. package/dist/runtime/client.d.ts +1 -1
  25. package/dist/runtime/client.js +3 -4
  26. package/dist/runtime/node.d.ts +1 -1
  27. package/dist/runtime/node.js +6 -8
  28. package/dist/{types-Duk127zu.d.ts → types-C9WEqIOF.d.ts} +3 -1
  29. package/dist/vike.d.ts +1 -1
  30. package/dist/vike.js +14 -10
  31. package/dist/vike.js.map +1 -1
  32. package/package.json +6 -5
  33. package/dist/chunk-G6PC37P5.js.map +0 -1
  34. package/dist/chunk-L6ZVB6XH.js +0 -36
  35. package/dist/chunk-L6ZVB6XH.js.map +0 -1
  36. package/dist/chunk-MPERUGQD.js.map +0 -1
  37. package/dist/chunk-SOVTSE5J.js.map +0 -1
  38. package/dist/chunk-UMH7S7OB.js +0 -445
  39. package/dist/chunk-UMH7S7OB.js.map +0 -1
  40. package/dist/chunk-VGBPF5O7.js.map +0 -1
  41. /package/dist/{chunk-WEGYZIYX.js.map → chunk-H4A5UBJ5.js.map} +0 -0
@@ -1,16 +1,425 @@
1
1
  import {
2
- extractDocHeadings
3
- } from "./chunk-SOVTSE5J.js";
2
+ extractDocHeadings,
3
+ getDocsIconMapKey
4
+ } from "./chunk-AT4O3RRN.js";
4
5
  import {
5
- getDocsIconMapKey,
6
- getResolvedPageById,
7
- resolveDocsConfig
8
- } from "./chunk-UMH7S7OB.js";
6
+ nivelAssetUrl,
7
+ resolvePublicAssetUrl,
8
+ withSiteBaseUrl
9
+ } from "./chunk-PYYPYIBD.js";
10
+
11
+ // src/docs/icons.ts
12
+ import * as lucideIcons from "lucide-react";
13
+ var excludedLucideExports = /* @__PURE__ */ new Set(["createLucideIcon", "Icon", "icons", "LucideProvider", "useLucideContext"]);
14
+ var isLucideIconExport = (value) => {
15
+ if (typeof value !== "object" || value === null) {
16
+ return false;
17
+ }
18
+ return "$$typeof" in value && "render" in value;
19
+ };
20
+ var docsIconNames = Object.freeze(
21
+ Object.entries(lucideIcons).filter(([name, value]) => !excludedLucideExports.has(name) && isLucideIconExport(value)).map(([name]) => name).sort()
22
+ );
23
+ var docsIconNameSet = new Set(docsIconNames);
24
+ var isDocsIconName = (value) => {
25
+ return docsIconNameSet.has(value);
26
+ };
27
+ var assertDocsIconName = (value, context) => {
28
+ if (isDocsIconName(value)) {
29
+ return;
30
+ }
31
+ throw new Error(
32
+ `${context} must be a valid lucide-react icon export. Received "${value}". See https://lucide.dev/icons/`
33
+ );
34
+ };
35
+
36
+ // src/docs/resolveDocsConfig.ts
37
+ var isExternalHref = (value) => {
38
+ return /^(?:[a-z]+:)?\/\//i.test(value) || value.startsWith("mailto:") || value.startsWith("tel:");
39
+ };
40
+ var normalizeBasePath = (value) => {
41
+ const normalized = value.trim();
42
+ if (!normalized) {
43
+ throw new Error("Docs basePath must be a non-empty absolute path.");
44
+ }
45
+ if (!normalized.startsWith("/") || normalized.startsWith("//")) {
46
+ throw new Error(`Docs basePath must start with "/". Received ${JSON.stringify(value)}.`);
47
+ }
48
+ if (normalized.includes("?") || normalized.includes("#")) {
49
+ throw new Error(`Docs basePath cannot include query strings or hashes. Received ${JSON.stringify(value)}.`);
50
+ }
51
+ const collapsed = normalized.replace(/\/+/g, "/").replace(/\/+$/g, "");
52
+ return collapsed === "" ? "/" : collapsed;
53
+ };
54
+ var normalizeContentDir = (value) => {
55
+ const normalized = (value ?? "docs").trim();
56
+ if (!normalized) {
57
+ throw new Error("Docs contentDir must be a non-empty project-relative path.");
58
+ }
59
+ if (normalized.startsWith("/") || normalized.startsWith("\\")) {
60
+ throw new Error(`Docs contentDir must be project-relative. Received ${JSON.stringify(value)}.`);
61
+ }
62
+ if (/^[a-zA-Z]:[\\/]/.test(normalized)) {
63
+ throw new Error(`Docs contentDir must be project-relative. Received ${JSON.stringify(value)}.`);
64
+ }
65
+ const segments = normalized.replaceAll("\\", "/").split("/");
66
+ const resolvedSegments = [];
67
+ for (const segment of segments) {
68
+ if (segment === "" || segment === ".") {
69
+ continue;
70
+ }
71
+ if (segment === "..") {
72
+ throw new Error(`Docs contentDir cannot escape the project root. Received ${JSON.stringify(value)}.`);
73
+ }
74
+ resolvedSegments.push(segment);
75
+ }
76
+ if (resolvedSegments.length === 0) {
77
+ throw new Error(`Docs contentDir must contain at least one path segment. Received ${JSON.stringify(value)}.`);
78
+ }
79
+ return resolvedSegments.join("/");
80
+ };
81
+ var normalizeSlug = (value) => value.replace(/^\/+|\/+$/g, "");
82
+ var joinDocsHref = (basePath, slug) => {
83
+ const normalizedBasePath = normalizeBasePath(basePath);
84
+ const normalizedSlug = normalizeSlug(slug);
85
+ if (!normalizedSlug) {
86
+ return normalizedBasePath === "/" ? "/" : `${normalizedBasePath}/`;
87
+ }
88
+ return normalizedBasePath === "/" ? `/${normalizedSlug}/` : `${normalizedBasePath}/${normalizedSlug}/`;
89
+ };
90
+ var normalizePathname = (value) => {
91
+ const pathname = value.split("?")[0]?.split("#")[0] ?? value;
92
+ const normalized = pathname.trim().replace(/\/+$/g, "");
93
+ return normalized === "" ? "/" : `${normalized}/`.replace(/\/+/g, "/");
94
+ };
95
+ var resolveDocsHref = (basePath, href) => {
96
+ const normalized = href.trim();
97
+ if (!normalized || normalized.startsWith("#") || isExternalHref(normalized)) {
98
+ return null;
99
+ }
100
+ const pathname = normalized.split("?")[0]?.split("#")[0] ?? normalized;
101
+ if (!pathname) {
102
+ return null;
103
+ }
104
+ if (pathname.startsWith("/")) {
105
+ const normalizedPathname = normalizePathname(pathname);
106
+ const normalizedBasePath = normalizeBasePath(basePath);
107
+ if (normalizedBasePath === "/") {
108
+ return normalizedPathname;
109
+ }
110
+ return normalizedPathname === `${normalizedBasePath}/` || normalizedPathname.startsWith(`${normalizedBasePath}/`) ? normalizedPathname : null;
111
+ }
112
+ if (pathname.startsWith("./") || pathname.startsWith("../")) {
113
+ return null;
114
+ }
115
+ return joinDocsHref(basePath, pathname);
116
+ };
117
+ var normalizeSourcePath = (value) => {
118
+ const segments = value.replaceAll("\\", "/").split("/");
119
+ const normalizedSegments = [];
120
+ for (const segment of segments) {
121
+ if (segment === "" || segment === ".") {
122
+ continue;
123
+ }
124
+ if (segment === "..") {
125
+ normalizedSegments.pop();
126
+ continue;
127
+ }
128
+ normalizedSegments.push(segment);
129
+ }
130
+ return normalizedSegments.join("/");
131
+ };
132
+ var getSectionHref = (items, visibleOnly = false) => {
133
+ for (const item of items) {
134
+ if (item.kind === "page") {
135
+ if (visibleOnly && !item.showInNav) {
136
+ continue;
137
+ }
138
+ return item.href;
139
+ }
140
+ if (item.kind === "group") {
141
+ if (visibleOnly && !item.showInNav) {
142
+ continue;
143
+ }
144
+ const href = getSectionHref(item.items, visibleOnly);
145
+ if (href) {
146
+ return href;
147
+ }
148
+ }
149
+ }
150
+ return null;
151
+ };
152
+ var resolveNavigationHref = (value, fieldName, basePath) => {
153
+ const normalized = value.trim();
154
+ if (!normalized) {
155
+ throw new Error(`Docs ${fieldName} must be a non-empty string.`);
156
+ }
157
+ if (normalized.startsWith("#") || isExternalHref(normalized)) {
158
+ return normalized;
159
+ }
160
+ if (!normalized.startsWith("/")) {
161
+ return joinDocsHref(basePath, normalized);
162
+ }
163
+ return normalizePathname(normalized);
164
+ };
165
+ var resolveThemeConfig = (theme) => {
166
+ return {
167
+ light: theme?.light ?? "consumer-light",
168
+ dark: theme?.dark ?? "consumer-dark",
169
+ defaultPreference: theme?.defaultPreference ?? "light"
170
+ };
171
+ };
172
+ var resolveFooterConfig = (footer) => {
173
+ return {
174
+ pagination: footer?.pagination ?? false
175
+ };
176
+ };
177
+ var resolveRobotsConfig = (robots) => {
178
+ return robots ?? true;
179
+ };
180
+ var resolveBrandConfig = (brand, siteTitle) => {
181
+ const text = brand?.text ?? siteTitle;
182
+ return {
183
+ text,
184
+ href: withSiteBaseUrl(brand?.href ?? "/"),
185
+ logoLight: resolvePublicAssetUrl(brand?.logoLight),
186
+ logoDark: resolvePublicAssetUrl(brand?.logoDark),
187
+ logoAlt: brand?.logoAlt ?? `${text} logo`
188
+ };
189
+ };
190
+ var resolveHeadConfig = (head) => {
191
+ const fontPreset = head?.fontPreset ?? "inter";
192
+ const defaultFontStylesheetHref = fontPreset === "inter" ? nivelAssetUrl("fonts/fonts-inter.css") : void 0;
193
+ const defaultFontPreloadHrefs = fontPreset === "inter" ? [
194
+ nivelAssetUrl("fonts/inter-v20-latin-regular.woff2"),
195
+ nivelAssetUrl("fonts/inter-v20-latin-600.woff2"),
196
+ nivelAssetUrl("fonts/inter-v20-latin-800.woff2")
197
+ ] : [];
198
+ return {
199
+ faviconSvg: resolvePublicAssetUrl(head?.faviconSvg),
200
+ faviconIco: resolvePublicAssetUrl(head?.faviconIco),
201
+ appleTouchIcon: resolvePublicAssetUrl(head?.appleTouchIcon),
202
+ fontPreset,
203
+ fontStylesheetHref: head?.fontStylesheetHref ?? defaultFontStylesheetHref,
204
+ fontPreloadHrefs: head?.fontPreloadHrefs ?? defaultFontPreloadHrefs
205
+ };
206
+ };
207
+ var resolvePartnerAssetUrl = (value) => {
208
+ if (!value) {
209
+ return void 0;
210
+ }
211
+ return resolvePublicAssetUrl(value);
212
+ };
213
+ var resolvePartner = (partner) => {
214
+ return {
215
+ name: partner.name,
216
+ href: withSiteBaseUrl(partner.href),
217
+ logoLight: resolvePartnerAssetUrl(partner.logoLight) ?? partner.logoLight,
218
+ logoDark: resolvePartnerAssetUrl(partner.logoDark),
219
+ logoAlt: partner.logoAlt ?? `${partner.name} logo`
220
+ };
221
+ };
222
+ var resolveSocialConfig = (social) => {
223
+ return {
224
+ ...social
225
+ };
226
+ };
227
+ var resolvePartnersConfig = (partners) => {
228
+ return {
229
+ primary: (partners?.primary ?? []).map(resolvePartner),
230
+ gold: (partners?.gold ?? []).map(resolvePartner)
231
+ };
232
+ };
233
+ var requireTrimmedString = (value, fieldName) => {
234
+ const normalized = value.trim();
235
+ if (!normalized) {
236
+ throw new Error(`Docs algolia config "${fieldName}" must be a non-empty string.`);
237
+ }
238
+ return normalized;
239
+ };
240
+ var resolveAlgoliaConfig = (algolia) => {
241
+ if (!algolia) {
242
+ return null;
243
+ }
244
+ return {
245
+ appId: requireTrimmedString(algolia.appId, "appId"),
246
+ apiKey: requireTrimmedString(algolia.apiKey, "apiKey"),
247
+ indexName: requireTrimmedString(algolia.indexName, "indexName"),
248
+ fields: {
249
+ href: algolia.fields?.href?.trim() || "href",
250
+ title: algolia.fields?.title?.trim() || "title",
251
+ excerpt: algolia.fields?.excerpt?.trim() || "excerpt",
252
+ sectionTitle: algolia.fields?.sectionTitle?.trim() || "sectionTitle"
253
+ },
254
+ searchParams: algolia.searchParams ?? {}
255
+ };
256
+ };
257
+ var normalizeAliases = (aliases, slug) => {
258
+ const normalizedAliases = /* @__PURE__ */ new Set();
259
+ for (const alias of aliases ?? []) {
260
+ const normalizedAlias = normalizeSlug(alias);
261
+ if (!normalizedAlias || normalizedAlias === slug) {
262
+ continue;
263
+ }
264
+ normalizedAliases.add(normalizedAlias);
265
+ }
266
+ return [...normalizedAliases];
267
+ };
268
+ var resolveDocsConfig = (config) => {
269
+ const normalizedBasePath = normalizeBasePath(config.basePath);
270
+ const normalizedContentDir = normalizeContentDir(config.contentDir);
271
+ const pageIds = /* @__PURE__ */ new Set();
272
+ const pageSlugs = /* @__PURE__ */ new Set();
273
+ const pageAliases = /* @__PURE__ */ new Set();
274
+ const groupIds = /* @__PURE__ */ new Set();
275
+ const sectionIds = /* @__PURE__ */ new Set();
276
+ const pages = [];
277
+ const navbarItems = [];
278
+ const resolveSidebarNodes = (nodes, sectionId) => {
279
+ return nodes.map((node) => {
280
+ if (node.kind === "group") {
281
+ if (groupIds.has(node.id)) {
282
+ throw new Error(`Duplicate docs group id "${node.id}".`);
283
+ }
284
+ if (node.icon) {
285
+ assertDocsIconName(node.icon, `Docs group "${node.id}" icon`);
286
+ }
287
+ groupIds.add(node.id);
288
+ return {
289
+ kind: "group",
290
+ id: node.id,
291
+ title: node.title,
292
+ href: node.href ? resolveNavigationHref(node.href, `group "${node.id}" href`, normalizedBasePath) : void 0,
293
+ showInNav: node.showInNav ?? true,
294
+ collapsible: node.collapsible,
295
+ items: resolveSidebarNodes(node.items, sectionId),
296
+ icon: node.icon
297
+ };
298
+ }
299
+ if (node.kind !== "page") {
300
+ throw new Error(`Invalid docs sidebar node: ${JSON.stringify(node)}`);
301
+ }
302
+ const pageNode = node;
303
+ const slug = normalizeSlug(pageNode.slug);
304
+ const aliases = normalizeAliases(pageNode.aliases, slug);
305
+ if (pageNode.icon) {
306
+ assertDocsIconName(pageNode.icon, `Docs page "${pageNode.id}" icon`);
307
+ }
308
+ if (!slug) {
309
+ throw new Error(`Docs page "${pageNode.id}" must define a non-empty slug.`);
310
+ }
311
+ if (pageIds.has(pageNode.id)) {
312
+ throw new Error(`Duplicate docs page id "${pageNode.id}".`);
313
+ }
314
+ if (pageSlugs.has(slug)) {
315
+ throw new Error(`Duplicate docs page slug "${slug}".`);
316
+ }
317
+ for (const alias of aliases) {
318
+ if (pageSlugs.has(alias) || pageAliases.has(alias)) {
319
+ throw new Error(`Duplicate docs page alias "${alias}".`);
320
+ }
321
+ }
322
+ pageIds.add(pageNode.id);
323
+ pageSlugs.add(slug);
324
+ for (const alias of aliases) {
325
+ pageAliases.add(alias);
326
+ }
327
+ const href = joinDocsHref(normalizedBasePath, slug);
328
+ const page = {
329
+ ...pageNode,
330
+ slug,
331
+ aliases,
332
+ href,
333
+ aliasHrefs: aliases.map((alias) => joinDocsHref(normalizedBasePath, alias)),
334
+ tableOfContents: pageNode.tableOfContents ?? true,
335
+ sectionId,
336
+ documentTitle: `${pageNode.title} | ${config.siteTitle}`,
337
+ source: normalizeSourcePath(pageNode.source)
338
+ };
339
+ pages.push(page);
340
+ return {
341
+ kind: "page",
342
+ id: pageNode.id,
343
+ title: pageNode.title,
344
+ navTitle: pageNode.navTitle ?? pageNode.title,
345
+ href,
346
+ showInNav: pageNode.showInNav ?? true,
347
+ icon: pageNode.icon
348
+ };
349
+ });
350
+ };
351
+ const sections = config.graph.items.map((section) => {
352
+ if (section.kind !== "section") {
353
+ throw new Error(`Top-level docs graph items must be sections. Received ${JSON.stringify(section)}`);
354
+ }
355
+ if (sectionIds.has(section.id)) {
356
+ throw new Error(`Duplicate docs section id "${section.id}".`);
357
+ }
358
+ if (section.icon) {
359
+ assertDocsIconName(section.icon, `Docs section "${section.id}" icon`);
360
+ }
361
+ sectionIds.add(section.id);
362
+ const items = resolveSidebarNodes(section.items, section.id);
363
+ const firstVisibleHref = getSectionHref(items, true);
364
+ const href = section.href ? resolveNavigationHref(section.href, `section "${section.id}" href`, normalizedBasePath) : firstVisibleHref ?? getSectionHref(items);
365
+ if (!href) {
366
+ throw new Error(`Docs section "${section.id}" must contain at least one page.`);
367
+ }
368
+ const resolvedSection = {
369
+ id: section.id,
370
+ title: section.title,
371
+ navTitle: section.navTitle ?? section.title,
372
+ href,
373
+ items,
374
+ icon: section.icon
375
+ };
376
+ navbarItems.push({
377
+ id: section.id,
378
+ title: resolvedSection.navTitle,
379
+ href: resolvedSection.href
380
+ });
381
+ return resolvedSection;
382
+ });
383
+ if (pages.length === 0) {
384
+ throw new Error("Docs graph must contain at least one page.");
385
+ }
386
+ return {
387
+ siteTitle: config.siteTitle,
388
+ siteDescription: config.siteDescription ?? null,
389
+ robots: resolveRobotsConfig(config.robots),
390
+ basePath: normalizedBasePath,
391
+ contentDir: normalizedContentDir,
392
+ theme: resolveThemeConfig(config.theme),
393
+ footer: resolveFooterConfig(config.footer),
394
+ brand: resolveBrandConfig(config.brand, config.siteTitle),
395
+ head: resolveHeadConfig(config.head),
396
+ partners: resolvePartnersConfig(config.partners),
397
+ social: resolveSocialConfig(config.social),
398
+ algolia: resolveAlgoliaConfig(config.algolia),
399
+ pages,
400
+ sections,
401
+ navbarItems
402
+ };
403
+ };
404
+ var getResolvedPageById = (config, pageId) => {
405
+ const page = config.pages.find((candidate) => candidate.id === pageId);
406
+ if (!page) {
407
+ throw new Error(`Unknown docs page id "${pageId}".`);
408
+ }
409
+ return page;
410
+ };
9
411
 
10
412
  // src/runtime/node/codegen.ts
11
413
  import fs from "fs";
414
+ import { createRequire } from "module";
12
415
  import path from "path";
13
416
  var GENERATED_DIRNAME = "(nivel-generated)";
417
+ var require2 = createRequire(import.meta.url);
418
+ var lucidePackageRoot = path.dirname(require2.resolve("lucide-react/package.json"));
419
+ var lucideEsmEntryPath = path.join(lucidePackageRoot, "dist", "esm", "lucide-react.js");
420
+ var lucideEsmIconsDirectoryPath = path.join(lucidePackageRoot, "dist", "esm", "icons");
421
+ var lucideIconModuleNameByExportName = null;
422
+ var lucideIconNodeByName = /* @__PURE__ */ new Map();
14
423
  var writeFileIfChanged = (filePath, source) => {
15
424
  const current = fs.existsSync(filePath) ? fs.readFileSync(filePath, "utf8") : null;
16
425
  if (current === source) {
@@ -110,6 +519,105 @@ var getGeneratedIconMapSource = (entries) => {
110
519
  }
111
520
  return ["{", ...entries.map(({ iconKey, iconName }) => ` ${JSON.stringify(iconKey)}: ${iconName},`), "}"].join("\n");
112
521
  };
522
+ var getLucideIconModuleNameByExportName = () => {
523
+ if (lucideIconModuleNameByExportName) {
524
+ return lucideIconModuleNameByExportName;
525
+ }
526
+ const lucideEntrySource = fs.readFileSync(lucideEsmEntryPath, "utf8");
527
+ const exportMap = /* @__PURE__ */ new Map();
528
+ const exportPattern = /export\s+\{\s*([\s\S]*?)\s*\}\s+from\s+'\.\/icons\/([^']+)\.js';/g;
529
+ for (const match of lucideEntrySource.matchAll(exportPattern)) {
530
+ const exportsSource = match[1];
531
+ const moduleName = match[2];
532
+ if (!exportsSource || !moduleName) {
533
+ continue;
534
+ }
535
+ for (const exportPart of exportsSource.split(",").map((value) => value.trim())) {
536
+ const exportMatch = /^default as (\w+)$/.exec(exportPart);
537
+ if (!exportMatch?.[1]) {
538
+ continue;
539
+ }
540
+ exportMap.set(exportMatch[1], moduleName);
541
+ }
542
+ }
543
+ lucideIconModuleNameByExportName = exportMap;
544
+ return exportMap;
545
+ };
546
+ var getDocsIconNode = (iconName) => {
547
+ const cachedIconNode = lucideIconNodeByName.get(iconName);
548
+ if (cachedIconNode) {
549
+ return cachedIconNode;
550
+ }
551
+ const moduleName = getLucideIconModuleNameByExportName().get(iconName);
552
+ if (!moduleName) {
553
+ throw new Error(`Unable to resolve lucide-react module for docs icon "${iconName}".`);
554
+ }
555
+ const iconModuleSource = fs.readFileSync(path.join(lucideEsmIconsDirectoryPath, `${moduleName}.js`), "utf8");
556
+ const iconNodeMatch = /const __iconNode = (\[[\s\S]*?\]);\s*const /.exec(iconModuleSource);
557
+ if (!iconNodeMatch?.[1]) {
558
+ throw new Error(`Unable to read lucide-react icon node for docs icon "${iconName}".`);
559
+ }
560
+ const iconNode = Function(`"use strict"; return (${iconNodeMatch[1]})`)();
561
+ lucideIconNodeByName.set(iconName, iconNode);
562
+ return iconNode;
563
+ };
564
+ var getGeneratedIconDefinitionsSource = (iconNames) => {
565
+ if (iconNames.length === 0) {
566
+ return [];
567
+ }
568
+ const definitions = iconNames.flatMap((iconName) => {
569
+ return [`const ${iconName} = createDocsIcon(${JSON.stringify(getDocsIconNode(iconName))})`, ""];
570
+ });
571
+ return [
572
+ "import { createElement, forwardRef, type SVGProps } from 'react'",
573
+ "",
574
+ "type DocsGeneratedIconProps = SVGProps<SVGSVGElement> & {",
575
+ " size?: string | number",
576
+ " absoluteStrokeWidth?: boolean",
577
+ "}",
578
+ "",
579
+ "type DocsGeneratedIconNode = [tagName: string, attrs: Record<string, string>][]",
580
+ "",
581
+ "const docsGeneratedIconSvgAttrs = {",
582
+ " xmlns: 'http://www.w3.org/2000/svg',",
583
+ " fill: 'none',",
584
+ " viewBox: '0 0 24 24',",
585
+ " stroke: 'currentColor',",
586
+ " strokeWidth: 2,",
587
+ " strokeLinecap: 'round',",
588
+ " strokeLinejoin: 'round',",
589
+ "} as const",
590
+ "",
591
+ "const createDocsIcon = (iconNode: DocsGeneratedIconNode) => {",
592
+ " return forwardRef<SVGSVGElement, DocsGeneratedIconProps>(",
593
+ ' ({ color = "currentColor", size = 24, strokeWidth = 2, absoluteStrokeWidth, children, ...props }, ref) => {',
594
+ " const resolvedSize = typeof size === 'number' ? size : Number(size)",
595
+ " const resolvedStrokeWidth =",
596
+ " absoluteStrokeWidth && Number.isFinite(resolvedSize) && resolvedSize > 0",
597
+ " ? (Number(strokeWidth) * 24) / resolvedSize",
598
+ " : strokeWidth",
599
+ "",
600
+ " return createElement(",
601
+ " 'svg',",
602
+ " {",
603
+ " ...docsGeneratedIconSvgAttrs,",
604
+ " ...props,",
605
+ " ref,",
606
+ " width: size,",
607
+ " height: size,",
608
+ " stroke: color,",
609
+ " strokeWidth: resolvedStrokeWidth,",
610
+ " },",
611
+ " ...iconNode.map(([tagName, attrs]) => createElement(tagName, attrs)),",
612
+ " children,",
613
+ " )",
614
+ " },",
615
+ " )",
616
+ "}",
617
+ "",
618
+ ...definitions
619
+ ];
620
+ };
113
621
  var getGeneratedGlobalContextSource = (data) => {
114
622
  const iconEntries = data.sidebarSections.flatMap((section) => {
115
623
  const sectionIconEntries = section.icon ? [{ iconKey: getDocsIconMapKey("section", section.id), iconName: section.icon }] : [];
@@ -118,7 +626,7 @@ var getGeneratedGlobalContextSource = (data) => {
118
626
  const iconImports = [...new Set(iconEntries.map(({ iconName }) => iconName))].sort();
119
627
  return [
120
628
  "import type { DocsGlobalContextData, DocsGlobalContextSerializableData, DocsIconMap } from '@unterberg/nivel'",
121
- ...iconImports.length > 0 ? [`import { ${iconImports.join(", ")} } from '@unterberg/nivel/icons'`] : [],
629
+ ...getGeneratedIconDefinitionsSource(iconImports),
122
630
  "",
123
631
  `const docsGlobalContextSerializableData: DocsGlobalContextSerializableData = ${serializeData(data)}`,
124
632
  "",
@@ -194,6 +702,7 @@ var syncGeneratedDocsPages = (options) => {
194
702
  fs.mkdirSync(generatedPagesRoot, { recursive: true });
195
703
  const globalContextData = {
196
704
  siteTitle: resolved.siteTitle,
705
+ robots: resolved.robots,
197
706
  basePath: resolved.basePath,
198
707
  theme: resolved.theme,
199
708
  footer: resolved.footer,
@@ -314,6 +823,8 @@ var getDocsConfigTemplate = () => {
314
823
  " siteDescription: 'Documentation site powered by @unterberg/nivel.',",
315
824
  " // Add siteUrl to enable automatic sitemap.xml and robots.txt generation.",
316
825
  " // siteUrl: 'https://docs.example.com',",
826
+ " // Set robots to false to emit noindex/nofollow and a disallow-all robots.txt.",
827
+ " // robots: false,",
317
828
  " basePath: '/docs',",
318
829
  "} satisfies DocsConfig",
319
830
  "",
@@ -762,6 +1273,9 @@ var initConsumer = (options) => {
762
1273
  };
763
1274
 
764
1275
  export {
1276
+ resolveDocsHref,
1277
+ resolveDocsConfig,
1278
+ getResolvedPageById,
765
1279
  getGeneratedPagesRoot,
766
1280
  getDocsSourcePaths,
767
1281
  isDocsSourcePath,
@@ -772,4 +1286,4 @@ export {
772
1286
  getInitSummary,
773
1287
  initConsumer
774
1288
  };
775
- //# sourceMappingURL=chunk-G6PC37P5.js.map
1289
+ //# sourceMappingURL=chunk-IEWXVGSC.js.map