create-zudo-doc 3.2.0 → 3.3.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/dist/claude-md-gen.d.ts +8 -0
- package/dist/claude-md-gen.js +43 -26
- package/dist/compose.d.ts +14 -20
- package/dist/compose.js +15 -25
- package/dist/features/body-foot-util.d.ts +8 -4
- package/dist/features/body-foot-util.js +8 -4
- package/dist/features/claude-resources.d.ts +12 -0
- package/dist/features/claude-resources.js +13 -6
- package/dist/features/design-token-panel.d.ts +0 -12
- package/dist/features/design-token-panel.js +32 -93
- package/dist/features/doc-history.d.ts +18 -3
- package/dist/features/doc-history.js +45 -60
- package/dist/features/doc-tags.d.ts +9 -13
- package/dist/features/doc-tags.js +10 -26
- package/dist/features/dynamic-page-transition.d.ts +19 -30
- package/dist/features/dynamic-page-transition.js +21 -209
- package/dist/features/footer-taglist.d.ts +1 -1
- package/dist/features/footer-taglist.js +1 -1
- package/dist/features/footer.d.ts +3 -2
- package/dist/features/footer.js +3 -2
- package/dist/features/i18n.d.ts +13 -8
- package/dist/features/i18n.js +14 -9
- package/dist/features/image-enlarge.d.ts +7 -26
- package/dist/features/image-enlarge.js +7 -26
- package/dist/features/llms-txt.d.ts +3 -5
- package/dist/features/llms-txt.js +3 -5
- package/dist/features/search.d.ts +7 -3
- package/dist/features/search.js +7 -3
- package/dist/features/sidebar-resizer.d.ts +4 -8
- package/dist/features/sidebar-resizer.js +4 -8
- package/dist/features/sidebar-toggle.d.ts +7 -7
- package/dist/features/sidebar-toggle.js +7 -7
- package/dist/features/tag-governance.d.ts +14 -7
- package/dist/features/tag-governance.js +52 -8
- package/dist/features/tauri.d.ts +13 -10
- package/dist/features/tauri.js +16 -52
- package/dist/features/versioning.d.ts +12 -24
- package/dist/features/versioning.js +13 -39
- package/dist/index.js +2 -3
- package/dist/scaffold.d.ts +13 -6
- package/dist/scaffold.js +64 -45
- package/dist/utils.d.ts +10 -0
- package/dist/utils.js +14 -0
- package/dist/zfb-config-gen.d.ts +32 -20
- package/dist/zfb-config-gen.js +400 -53
- package/package.json +2 -2
- package/templates/base/pages/docs/[[...slug]].tsx +59 -0
- package/templates/base/pages/index.tsx +6 -41
- package/templates/base/src/styles/global.css +15 -340
- package/templates/base/tsconfig.json +3 -26
- package/templates/features/i18n/files/pages/[locale]/docs/[[...slug]].tsx +88 -0
- package/templates/features/tagGovernance/files/scripts/tags-suggest.ts +3 -1
- package/dist/settings-gen.d.ts +0 -2
- package/dist/settings-gen.js +0 -320
- package/templates/base/.htmlvalidate.json +0 -5
- package/templates/base/.zfb/doc-history-meta.json +0 -1
- package/templates/base/pages/_data.ts +0 -160
- package/templates/base/pages/lib/_body-end-islands.tsx +0 -165
- package/templates/base/pages/lib/_chrome.ts +0 -167
- package/templates/base/pages/lib/_details.tsx +0 -29
- package/templates/base/pages/lib/_doc-route-entries.ts +0 -10
- package/templates/base/pages/lib/_extract-headings.ts +0 -37
- package/templates/base/pages/lib/_frontmatter-preview-data.ts +0 -27
- package/templates/base/pages/lib/_nav-source-cache.ts +0 -100
- package/templates/base/pages/lib/_nav-source-docs.ts +0 -17
- package/templates/base/pages/lib/_preset-generator.tsx +0 -81
- package/templates/base/pages/lib/_route-context.ts +0 -32
- package/templates/base/pages/lib/_search-widget.tsx +0 -17
- package/templates/base/pages/lib/doc-page-props.ts +0 -30
- package/templates/base/pages/lib/locale-merge.ts +0 -59
- package/templates/base/scripts/run-b4push.sh +0 -102
- package/templates/base/src/components/ai-chat-modal.tsx +0 -18
- package/templates/base/src/components/content/code-group.tsx +0 -3
- package/templates/base/src/components/content/content-admonition.tsx +0 -4
- package/templates/base/src/components/desktop-sidebar-toggle.tsx +0 -15
- package/templates/base/src/components/doc-history.tsx +0 -21
- package/templates/base/src/components/image-enlarge.tsx +0 -24
- package/templates/base/src/components/preset-generator.tsx +0 -14
- package/templates/base/src/components/sidebar-toggle.tsx +0 -6
- package/templates/base/src/components/sidebar-tree.tsx +0 -6
- package/templates/base/src/config/color-scheme-utils.ts +0 -69
- package/templates/base/src/config/color-schemes.ts +0 -165
- package/templates/base/src/config/docs-schema.ts +0 -95
- package/templates/base/src/config/frontmatter-preview-defaults.ts +0 -27
- package/templates/base/src/config/frontmatter-preview-renderers.tsx +0 -46
- package/templates/base/src/config/i18n.ts +0 -239
- package/templates/base/src/config/settings-types.ts +0 -45
- package/templates/base/src/config/sidebars.ts +0 -66
- package/templates/base/src/config/tag-vocabulary-types.ts +0 -4
- package/templates/base/src/config/tag-vocabulary.ts +0 -20
- package/templates/base/src/config/z-index-tokens.ts +0 -128
- package/templates/base/src/types/docs-entry.ts +0 -28
- package/templates/base/src/types/heading.ts +0 -5
- package/templates/base/src/types/locale.ts +0 -10
- package/templates/base/src/utils/base.ts +0 -164
- package/templates/base/src/utils/docs.ts +0 -446
- package/templates/base/src/utils/git-info.ts +0 -70
- package/templates/base/src/utils/github.ts +0 -22
- package/templates/base/src/utils/nav-scope.ts +0 -34
- package/templates/base/src/utils/sidebar.ts +0 -36
- package/templates/base/src/utils/slug.ts +0 -10
- package/templates/base/src/utils/smart-break.tsx +0 -12
- package/templates/base/src/utils/tags.ts +0 -83
- package/templates/base/zfb-shim.d.ts +0 -183
- package/templates/features/bodyFootUtil/files/src/utils/github.ts +0 -22
- package/templates/features/claudeResources/files/src/integrations/claude-resources/__tests__/escape-for-mdx.test.ts +0 -42
- package/templates/features/claudeResources/files/src/integrations/claude-resources/__tests__/generate.test.ts +0 -752
- package/templates/features/claudeResources/files/src/integrations/claude-resources/escape-for-mdx.ts +0 -97
- package/templates/features/claudeResources/files/src/integrations/claude-resources/generate.ts +0 -735
- package/templates/features/designTokenPanel/files/src/components/design-token-panel-bootstrap.tsx +0 -15
- package/templates/features/designTokenPanel/files/src/config/design-token-panel-config.ts +0 -435
- package/templates/features/designTokenPanel/files/src/config/design-tokens-manifest.ts +0 -174
- package/templates/features/designTokenPanel/files/src/lib/design-token-panel-bootstrap.ts +0 -30
- package/templates/features/docHistory/files/src/components/doc-history.tsx +0 -10
- package/templates/features/docHistory/files/src/types/doc-history.ts +0 -7
- package/templates/features/dynamicPageTransition/files/src/components/client-router-bootstrap.tsx +0 -72
- package/templates/features/i18n/files/pages/[locale]/index.tsx +0 -72
- package/templates/features/imageEnlarge/files/src/components/image-enlarge.tsx +0 -11
- package/templates/features/sidebarToggle/files/src/components/desktop-sidebar-toggle.tsx +0 -6
- package/templates/features/tauri/files/src/components/find-bar.tsx +0 -122
- package/templates/features/tauri/files/src/components/find-in-page-init.tsx +0 -59
- package/templates/features/tauri/files/src/utils/find-in-page.ts +0 -175
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
// Host thin-stub — see @takazudo/zudo-doc/github-helpers (epic #2344, S7).
|
|
2
|
-
//
|
|
3
|
-
// `buildGitHubRepoUrl` and `buildGitHubSourceUrl` are now parameterized pure
|
|
4
|
-
// functions in the package; this module wraps them with the host's
|
|
5
|
-
// `settings.githubUrl` singleton.
|
|
6
|
-
|
|
7
|
-
import { settings } from "@/config/settings";
|
|
8
|
-
import {
|
|
9
|
-
buildGitHubRepoUrl as _buildGitHubRepoUrl,
|
|
10
|
-
buildGitHubSourceUrl as _buildGitHubSourceUrl,
|
|
11
|
-
} from "@takazudo/zudo-doc/github-helpers";
|
|
12
|
-
|
|
13
|
-
export function buildGitHubRepoUrl(): string | null {
|
|
14
|
-
return _buildGitHubRepoUrl(settings.githubUrl);
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export function buildGitHubSourceUrl(
|
|
18
|
-
contentDir: string,
|
|
19
|
-
entryId: string,
|
|
20
|
-
): string | null {
|
|
21
|
-
return _buildGitHubSourceUrl(settings.githubUrl, contentDir, entryId);
|
|
22
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
// Host thin-stub for nav-scope utilities (epic #2344, S5).
|
|
2
|
-
// Core logic lives in @takazudo/zudo-doc/nav-scope; this stub wires
|
|
3
|
-
// the host's `settings.headerNav` singleton.
|
|
4
|
-
import { settings } from "@/config/settings";
|
|
5
|
-
import type { NavNode } from "@/utils/docs";
|
|
6
|
-
export type { HeaderNavItem } from "@/config/settings";
|
|
7
|
-
|
|
8
|
-
import {
|
|
9
|
-
getCategoryOrder as _getCategoryOrder,
|
|
10
|
-
getNavSectionForSlug as _getNavSectionForSlug,
|
|
11
|
-
getNavSubtree as _getNavSubtree,
|
|
12
|
-
} from "@takazudo/zudo-doc/nav-scope";
|
|
13
|
-
|
|
14
|
-
/** Collect all categoryMatch strings from headerNav, including children (ordered). */
|
|
15
|
-
export function getCategoryOrder(): string[] {
|
|
16
|
-
return _getCategoryOrder(settings.headerNav);
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Given a doc's slug, return the categoryMatch value of the headerNav item it belongs to.
|
|
21
|
-
*/
|
|
22
|
-
export function getNavSectionForSlug(slug: string): string | undefined {
|
|
23
|
-
return _getNavSectionForSlug(slug, settings.headerNav);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Filter top-level NavNodes by a headerNav categoryMatch value.
|
|
28
|
-
*/
|
|
29
|
-
export function getNavSubtree(
|
|
30
|
-
tree: NavNode[],
|
|
31
|
-
categoryMatch?: string,
|
|
32
|
-
): NavNode[] {
|
|
33
|
-
return _getNavSubtree(tree, categoryMatch, settings.headerNav);
|
|
34
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
// Host thin-stub for sidebar utilities (epic #2344, S5).
|
|
2
|
-
// Core logic lives in @takazudo/zudo-doc/sidebar-utils; this stub wires
|
|
3
|
-
// the host's singletons (sidebars config, getCategoryOrder for the "!" filter).
|
|
4
|
-
import sidebars from "@/config/sidebars";
|
|
5
|
-
import type { SidebarItem } from "@/config/sidebars";
|
|
6
|
-
import type { NavNode, CategoryMeta } from "@/utils/docs";
|
|
7
|
-
import { buildNavTree } from "@/utils/docs";
|
|
8
|
-
import { getCategoryOrder } from "@/utils/nav-scope";
|
|
9
|
-
import type { Locale } from "@/config/i18n";
|
|
10
|
-
import type { DocsEntry } from "@/types/docs-entry";
|
|
11
|
-
import { buildSidebarForSection as _buildSidebarForSection } from "@takazudo/zudo-doc/sidebar-utils";
|
|
12
|
-
|
|
13
|
-
export type { SidebarItem };
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Build sidebar nodes for a given nav section.
|
|
17
|
-
* If sidebar config exists for this section, use it.
|
|
18
|
-
* Otherwise fall back to auto-generated tree.
|
|
19
|
-
*/
|
|
20
|
-
export function buildSidebarForSection(
|
|
21
|
-
docs: DocsEntry[],
|
|
22
|
-
lang: Locale,
|
|
23
|
-
categoryMatch?: string,
|
|
24
|
-
categoryMeta?: Map<string, CategoryMeta>,
|
|
25
|
-
): NavNode[] {
|
|
26
|
-
const explicitPrefixes = getCategoryOrder().filter((cm) => cm !== "!");
|
|
27
|
-
return _buildSidebarForSection(
|
|
28
|
-
docs,
|
|
29
|
-
lang,
|
|
30
|
-
categoryMatch,
|
|
31
|
-
categoryMeta,
|
|
32
|
-
sidebars,
|
|
33
|
-
(d, l, meta) => buildNavTree(d as DocsEntry[], l as Locale, meta as Map<string, CategoryMeta>),
|
|
34
|
-
explicitPrefixes,
|
|
35
|
-
) as NavNode[];
|
|
36
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
// Thin re-export shim. The canonical slug rules moved into the package
|
|
2
|
-
// (`@takazudo/zudo-doc/slug`) as part of the package-first migration (#2344,
|
|
3
|
-
// S1a). Host code keeps importing from `@/utils/slug`; the implementation —
|
|
4
|
-
// including the canonical-root rule (#1891 / #1873) — lives once in the package.
|
|
5
|
-
export {
|
|
6
|
-
toRouteSlug,
|
|
7
|
-
toHistorySlug,
|
|
8
|
-
toSlugParams,
|
|
9
|
-
toTitleCase,
|
|
10
|
-
} from "@takazudo/zudo-doc/slug";
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
// Thin re-export shim. The smart-break helpers moved into the package
|
|
2
|
-
// (`@takazudo/zudo-doc/smart-break`) as part of the package-first migration
|
|
3
|
-
// (#2344, S1a) — consolidating with the former toc-local copy. Host code keeps
|
|
4
|
-
// importing from `@/utils/smart-break`; the implementation lives once in the
|
|
5
|
-
// package.
|
|
6
|
-
export {
|
|
7
|
-
isPathLike,
|
|
8
|
-
smartBreak,
|
|
9
|
-
SmartBreak,
|
|
10
|
-
escapeAndInjectWbr,
|
|
11
|
-
smartBreakToHtml,
|
|
12
|
-
} from "@takazudo/zudo-doc/smart-break";
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
// Host thin-stub — see @takazudo/zudo-doc/tag-helpers (epic #2344, S7).
|
|
2
|
-
//
|
|
3
|
-
// `resolveTag` and `resolvePageTags` are now parameterized pure functions in the
|
|
4
|
-
// package; this module remains backward-compatible by wrapping them with the
|
|
5
|
-
// host's `settings.tagVocabulary` / `settings.tagGovernance` + the
|
|
6
|
-
// `tagVocabulary` entries from `@/config/tag-vocabulary`.
|
|
7
|
-
//
|
|
8
|
-
// `collectTags` stays host-side because it depends on `DocsEntry` from the
|
|
9
|
-
// host's content collections. It calls the local `resolveTag` wrapper which
|
|
10
|
-
// in turn delegates to the package.
|
|
11
|
-
|
|
12
|
-
import type { DocsEntry } from "@/types/docs-entry";
|
|
13
|
-
import { settings } from "@/config/settings";
|
|
14
|
-
import { tagVocabulary } from "@/config/tag-vocabulary";
|
|
15
|
-
import {
|
|
16
|
-
resolveTag as _resolveTag,
|
|
17
|
-
resolvePageTags as _resolvePageTags,
|
|
18
|
-
} from "@takazudo/zudo-doc/tag-helpers";
|
|
19
|
-
|
|
20
|
-
export type { ResolvedTag } from "@takazudo/zudo-doc/tag-helpers";
|
|
21
|
-
|
|
22
|
-
export interface TagInfo {
|
|
23
|
-
tag: string;
|
|
24
|
-
count: number;
|
|
25
|
-
docs: { slug: string; title: string; description?: string }[];
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
// Helpers that pass the host's settings + vocabulary entries to the package fns.
|
|
29
|
-
function getVocab() {
|
|
30
|
-
return settings.tagVocabulary ? tagVocabulary : false;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* Resolve a raw tag string to its canonical form.
|
|
35
|
-
*
|
|
36
|
-
* Thin wrapper around `@takazudo/zudo-doc/tag-helpers` `resolveTag` that
|
|
37
|
-
* injects the host's tag vocabulary and governance settings.
|
|
38
|
-
*/
|
|
39
|
-
export function resolveTag(raw: string) {
|
|
40
|
-
return _resolveTag(raw, getVocab(), settings.tagGovernance);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* Resolve a list of raw tag strings (e.g. from frontmatter) to canonical ids,
|
|
45
|
-
* dropping deprecated-without-redirect entries and preserving order. Duplicates
|
|
46
|
-
* produced by alias collapse are removed.
|
|
47
|
-
*/
|
|
48
|
-
export function resolvePageTags(rawTags: readonly string[]): string[] {
|
|
49
|
-
return _resolvePageTags(rawTags, getVocab(), settings.tagGovernance);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
export function collectTags(
|
|
53
|
-
entries: DocsEntry[],
|
|
54
|
-
slugFn: (id: string, data: { slug?: string }) => string,
|
|
55
|
-
): Map<string, TagInfo> {
|
|
56
|
-
const tagMap = new Map<string, TagInfo>();
|
|
57
|
-
|
|
58
|
-
for (const entry of entries) {
|
|
59
|
-
const rawTags = entry.data.tags ?? [];
|
|
60
|
-
const slug = slugFn(entry.id, entry.data);
|
|
61
|
-
|
|
62
|
-
const seen = new Set<string>();
|
|
63
|
-
for (const raw of rawTags) {
|
|
64
|
-
const resolved = resolveTag(raw);
|
|
65
|
-
if (resolved.deprecated) continue;
|
|
66
|
-
if (seen.has(resolved.canonical)) continue;
|
|
67
|
-
seen.add(resolved.canonical);
|
|
68
|
-
|
|
69
|
-
if (!tagMap.has(resolved.canonical)) {
|
|
70
|
-
tagMap.set(resolved.canonical, { tag: resolved.canonical, count: 0, docs: [] });
|
|
71
|
-
}
|
|
72
|
-
const info = tagMap.get(resolved.canonical)!;
|
|
73
|
-
info.count++;
|
|
74
|
-
info.docs.push({
|
|
75
|
-
slug,
|
|
76
|
-
title: entry.data.title,
|
|
77
|
-
description: entry.data.description,
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
return tagMap;
|
|
83
|
-
}
|
|
@@ -1,183 +0,0 @@
|
|
|
1
|
-
// Local type shim for the bare `zfb/config` specifier.
|
|
2
|
-
//
|
|
3
|
-
// `@takazudo/zfb` is consumed as a published npm package (version pinned
|
|
4
|
-
// in the root `package.json`). The package exposes its real config types
|
|
5
|
-
// under the *scoped* subpath `@takazudo/zfb/config` → `dist/config.d.ts`.
|
|
6
|
-
// But `zfb.config.ts` imports from the *bare* specifier `zfb/config`,
|
|
7
|
-
// which zfb's build tool aliases to a runtime-only stub at parse time
|
|
8
|
-
// (`zfb-config-stub.mjs` — `defineConfig` is identity, carrying no types).
|
|
9
|
-
// No real file backs `zfb/config` in `node_modules`, so this ambient
|
|
10
|
-
// declaration is what supplies the `ZfbConfig` type to `zfb.config.ts`.
|
|
11
|
-
//
|
|
12
|
-
// IMPORTANT — this block is the source of truth for the type `zfb check`
|
|
13
|
-
// (plain `tsc --noEmit`) binds against the config. An ambient `declare
|
|
14
|
-
// module` wins over node resolution AND over tsconfig `paths`, so it must
|
|
15
|
-
// be kept in sync BY HAND with the published `@takazudo/zfb/config`
|
|
16
|
-
// (`dist/config.d.ts`). When it lags the engine, valid config fields fail
|
|
17
|
-
// `pnpm check` with TS2353 (see Takazudo/zudo-front-builder#678 +
|
|
18
|
-
// zudolab/zudo-doc#1834 — `bundle` was missing here, blocking next.22's
|
|
19
|
-
// `bundle.exclude`).
|
|
20
|
-
|
|
21
|
-
declare module "zfb/config" {
|
|
22
|
-
/** JSX framework runtime. */
|
|
23
|
-
export type Framework = "preact" | "react";
|
|
24
|
-
|
|
25
|
-
/** A content collection registered with the zfb engine. */
|
|
26
|
-
export interface CollectionDef {
|
|
27
|
-
/** Identifier used at the call site (e.g. `"docs"`). */
|
|
28
|
-
name: string;
|
|
29
|
-
/** Directory (relative to the project root) holding the entries. */
|
|
30
|
-
path: string;
|
|
31
|
-
/**
|
|
32
|
-
* Optional schema. Reserved for v1.1 — accepted but not enforced
|
|
33
|
-
* today. Authored as zod and converted to JSON Schema via
|
|
34
|
-
* `z.toJSONSchema()` at the boundary.
|
|
35
|
-
*/
|
|
36
|
-
schema?: Record<string, unknown>;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
/** Tailwind options; absent = defaults. */
|
|
40
|
-
export interface TailwindConfig {
|
|
41
|
-
enabled?: boolean;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
/** User-supplied plugin configuration entry. */
|
|
45
|
-
export interface PluginConfig {
|
|
46
|
-
name: string;
|
|
47
|
-
options?: Record<string, unknown>;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* Bundler options. Mirrors `BundleConfig` in crates/zfb/src/config.rs
|
|
52
|
-
* and the published `@takazudo/zfb/config` (`dist/config.d.ts`). Added
|
|
53
|
-
* in next.22 (`bundle.exclude`, #664) and extended in next.23
|
|
54
|
-
* (`mainFields` / `external`, #676).
|
|
55
|
-
*/
|
|
56
|
-
export interface BundleConfig {
|
|
57
|
-
/**
|
|
58
|
-
* Project-relative, gitignore-style globs for source files the bundler
|
|
59
|
-
* must NOT pull into the esbuild graph (e.g. test fixtures or
|
|
60
|
-
* `*.stories.tsx`). Matched files are skipped from the shadow-tree walk
|
|
61
|
-
* and dropped from any eager `import.meta.glob(...)` expansion.
|
|
62
|
-
*/
|
|
63
|
-
exclude?: string[];
|
|
64
|
-
/**
|
|
65
|
-
* Explicit esbuild `main-fields` for the `--platform=neutral` page/SSR
|
|
66
|
-
* pass (empty by default under `neutral`), letting CJS-`main`-only deps
|
|
67
|
-
* resolve. Mirrors `BundleConfig::main_fields`.
|
|
68
|
-
*/
|
|
69
|
-
mainFields?: string[];
|
|
70
|
-
/**
|
|
71
|
-
* Bare specifiers to mark external in the `--platform=neutral` pass so
|
|
72
|
-
* esbuild leaves them unbundled. Mirrors `BundleConfig::external`.
|
|
73
|
-
*/
|
|
74
|
-
external?: string[];
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
/** Mirrors the Rust `Config` struct one-for-one. */
|
|
78
|
-
export interface ZfbConfig {
|
|
79
|
-
outDir?: string;
|
|
80
|
-
publicDir?: string;
|
|
81
|
-
host?: string;
|
|
82
|
-
port?: number;
|
|
83
|
-
framework?: Framework;
|
|
84
|
-
collections?: CollectionDef[];
|
|
85
|
-
tailwind?: TailwindConfig;
|
|
86
|
-
/**
|
|
87
|
-
* Bundler options. `bundle.exclude` keeps project-relative globs out of
|
|
88
|
-
* the esbuild graph — used here to skip `packages/md-plugins/__fixtures__/**`
|
|
89
|
-
* so the MDX link resolver no longer walks the test fixtures (silences
|
|
90
|
-
* ~15 pre-existing broken-link warnings). Mirrors `Config::bundle`.
|
|
91
|
-
*/
|
|
92
|
-
bundle?: BundleConfig;
|
|
93
|
-
plugins?: PluginConfig[];
|
|
94
|
-
adapter?: string;
|
|
95
|
-
/**
|
|
96
|
-
* Strip `.md` / `.mdx` from in-page `<a href>` paths and append a
|
|
97
|
-
* trailing `/` so author-written `[label](other.mdx)` references
|
|
98
|
-
* resolve to the rendered route URL. Mirrors Config::strip_md_ext
|
|
99
|
-
* in crates/zfb/src/config.rs (zudolab/zfb#131).
|
|
100
|
-
*/
|
|
101
|
-
stripMdExt?: boolean;
|
|
102
|
-
/**
|
|
103
|
-
* Site base path. Prefixed onto stable HTML asset URLs (CSS / JS
|
|
104
|
-
* `<link>` and `<script>` tags). Normalised to start AND end with
|
|
105
|
-
* `/`; `undefined` / `""` / `"/"` all behave identically (no
|
|
106
|
-
* prefix). Mirrors Config::base in crates/zfb/src/config.rs
|
|
107
|
-
* (Takazudo/zudo-front-builder#154).
|
|
108
|
-
*/
|
|
109
|
-
base?: string;
|
|
110
|
-
/**
|
|
111
|
-
* Configures the syntect-based syntax highlighter shipped with zfb.
|
|
112
|
-
* Mirrors `CodeHighlightConfig` / `code_highlight` in crates/zfb/src/config.rs
|
|
113
|
-
* (single-theme: Takazudo/zudo-front-builder#188 / sub #194, commit 339e30f;
|
|
114
|
-
* dual-theme themeLight/themeDark added in the follow-up shipped in
|
|
115
|
-
* zfb 0.1.0-next.45+).
|
|
116
|
-
* When omitted, the engine falls back to the hardcoded default theme `base16-ocean.dark`.
|
|
117
|
-
*
|
|
118
|
-
* Single-theme mode: set `theme` — tokens get inline `style="color:#hex"`.
|
|
119
|
-
* Dual-theme mode: set BOTH `themeLight` and `themeDark` (mutually exclusive
|
|
120
|
-
* with `theme`) — tokens get `--shiki-light`/`--shiki-dark` CSS custom
|
|
121
|
-
* properties and the `<pre>` gains `class="syntect-dual"` + `--shiki-*-bg`.
|
|
122
|
-
* All names are SYNTECT theme names, not Shiki names.
|
|
123
|
-
*/
|
|
124
|
-
codeHighlight?: {
|
|
125
|
-
theme?: string;
|
|
126
|
-
themesDir?: string;
|
|
127
|
-
themeLight?: string;
|
|
128
|
-
themeDark?: string;
|
|
129
|
-
};
|
|
130
|
-
/**
|
|
131
|
-
* Markdown link resolver (port of `remarkResolveMarkdownLinks`).
|
|
132
|
-
* Mirrors `Config::resolve_markdown_links` in crates/zfb/src/config.rs
|
|
133
|
-
* (Takazudo/zudo-front-builder PR #234 / zudolab/zudo-doc#1577).
|
|
134
|
-
* When `enabled: true`, the build appends `ResolveLinksPlugin` to the
|
|
135
|
-
* mdast pipeline so author-written `[label](./other.mdx)` links are
|
|
136
|
-
* rewritten to the corresponding rendered route URL — bypassing the
|
|
137
|
-
* file→directory transformation that breaks relative paths in dist
|
|
138
|
-
* HTML when `foo.mdx` becomes `foo/index.html`.
|
|
139
|
-
*/
|
|
140
|
-
resolveMarkdownLinks?: {
|
|
141
|
-
enabled?: boolean;
|
|
142
|
-
docsDir?: string;
|
|
143
|
-
dirs?: Array<{ dir: string; routePrefix: string }>;
|
|
144
|
-
onBrokenLinks?: "warn" | "error" | "ignore";
|
|
145
|
-
};
|
|
146
|
-
/**
|
|
147
|
-
* Whether the basePath rewriter should append a trailing `/` to
|
|
148
|
-
* extensionless absolute hrefs. Mirrors `Config::trailing_slash` in
|
|
149
|
-
* crates/zfb/src/config.rs (Takazudo/zudo-front-builder PR #234 /
|
|
150
|
-
* zudolab/zudo-doc#1579). Off by default — preserves byte-for-byte
|
|
151
|
-
* parity with the pre-`trailingSlash` build for projects that
|
|
152
|
-
* haven't opted in.
|
|
153
|
-
*/
|
|
154
|
-
trailingSlash?: boolean;
|
|
155
|
-
/**
|
|
156
|
-
* Minify production HTML output from `zfb build`.
|
|
157
|
-
* Mirrors `Config::minify_html` in crates/zfb/src/config.rs.
|
|
158
|
-
*/
|
|
159
|
-
minifyHtml?: boolean;
|
|
160
|
-
/**
|
|
161
|
-
* Markdown / MDX pipeline options. Mirrors `Config::markdown` →
|
|
162
|
-
* `MarkdownConfig` in crates/zfb/src/config.rs. zfb next.12 moved the
|
|
163
|
-
* former-Core features under `markdown.features` and next.13 ships the
|
|
164
|
-
* rest as opt-in; zudo-doc uses `markdown.features` to opt back into the
|
|
165
|
-
* former-Core four plus the additional opt-in features (#1804). Each
|
|
166
|
-
* `features` value is per-feature: `true` for boolean-shorthand features,
|
|
167
|
-
* or an options object for object-typed features.
|
|
168
|
-
*/
|
|
169
|
-
markdown?: {
|
|
170
|
-
gfm?: boolean | Record<string, boolean>;
|
|
171
|
-
toc?: Record<string, unknown>;
|
|
172
|
-
externalLinks?: Record<string, unknown>;
|
|
173
|
-
cjkFriendly?: boolean;
|
|
174
|
-
features?: Record<string, boolean | Record<string, unknown>>;
|
|
175
|
-
};
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
/**
|
|
179
|
-
* Identity helper: returns the supplied config as-is, but typed
|
|
180
|
-
* against `ZfbConfig`. Use as the default export of `zfb.config.ts`.
|
|
181
|
-
*/
|
|
182
|
-
export function defineConfig(config: ZfbConfig): ZfbConfig;
|
|
183
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
// Host thin-stub — see @takazudo/zudo-doc/github-helpers (epic #2344, S7).
|
|
2
|
-
//
|
|
3
|
-
// `buildGitHubRepoUrl` and `buildGitHubSourceUrl` are now parameterized pure
|
|
4
|
-
// functions in the package; this module wraps them with the host's
|
|
5
|
-
// `settings.githubUrl` singleton.
|
|
6
|
-
|
|
7
|
-
import { settings } from "@/config/settings";
|
|
8
|
-
import {
|
|
9
|
-
buildGitHubRepoUrl as _buildGitHubRepoUrl,
|
|
10
|
-
buildGitHubSourceUrl as _buildGitHubSourceUrl,
|
|
11
|
-
} from "@takazudo/zudo-doc/github-helpers";
|
|
12
|
-
|
|
13
|
-
export function buildGitHubRepoUrl(): string | null {
|
|
14
|
-
return _buildGitHubRepoUrl(settings.githubUrl);
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export function buildGitHubSourceUrl(
|
|
18
|
-
contentDir: string,
|
|
19
|
-
entryId: string,
|
|
20
|
-
): string | null {
|
|
21
|
-
return _buildGitHubSourceUrl(settings.githubUrl, contentDir, entryId);
|
|
22
|
-
}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect } from "vitest";
|
|
2
|
-
import { escapeForMdx } from "../escape-for-mdx";
|
|
3
|
-
|
|
4
|
-
describe("escapeForMdx", () => {
|
|
5
|
-
// ---------------------------------------------------------------------------
|
|
6
|
-
// Path-like angle bracket sequences (not self-closing JSX)
|
|
7
|
-
// ---------------------------------------------------------------------------
|
|
8
|
-
|
|
9
|
-
it("escapes path-like <name>/suffix sequences", () => {
|
|
10
|
-
expect(escapeForMdx("<foo>/bar")).toBe("<foo>/bar");
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
it("escapes path-like angle brackets in prose", () => {
|
|
14
|
-
expect(escapeForMdx("binary at <repo>/target/release/zfb")).toBe(
|
|
15
|
-
"binary at <repo>/target/release/zfb",
|
|
16
|
-
);
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
// ---------------------------------------------------------------------------
|
|
20
|
-
// Allowlisted HTML tags must pass through unchanged
|
|
21
|
-
// ---------------------------------------------------------------------------
|
|
22
|
-
|
|
23
|
-
it("preserves allowlisted HTML tags followed by a path separator", () => {
|
|
24
|
-
expect(escapeForMdx("<div>/path")).toBe("<div>/path");
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
// ---------------------------------------------------------------------------
|
|
28
|
-
// Self-closing non-allowlisted tags must still be escaped
|
|
29
|
-
// ---------------------------------------------------------------------------
|
|
30
|
-
|
|
31
|
-
it("escapes self-closing non-allowlisted component tags", () => {
|
|
32
|
-
expect(escapeForMdx("<Component />")).toMatch(/<Component\s*\/>/);
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
it("escapes the compact self-closing form <Foo/> (no space before slash)", () => {
|
|
36
|
-
// Regression: the opening-tag regex only matches the spaced form <Foo />,
|
|
37
|
-
// so the compact <Foo/> needs the dedicated self-closing branch.
|
|
38
|
-
const out = escapeForMdx("<Foo/>");
|
|
39
|
-
expect(out).toBe("<Foo/>");
|
|
40
|
-
expect(out).not.toContain("<Foo/>");
|
|
41
|
-
});
|
|
42
|
-
});
|