create-zudo-doc 0.2.22 → 1.0.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/compose.d.ts +6 -3
- package/dist/compose.js +6 -4
- package/dist/features/image-enlarge.d.ts +15 -13
- package/dist/features/image-enlarge.js +16 -192
- package/dist/scaffold.d.ts +11 -0
- package/dist/scaffold.js +36 -7
- package/dist/settings-gen.js +4 -0
- package/package.json +1 -1
- package/templates/base/pages/_mdx-components.ts +64 -185
- package/templates/base/pages/index.tsx +1 -1
- package/templates/base/pages/lib/_extract-headings.ts +21 -295
- package/templates/base/pages/lib/_math-block.tsx +4 -63
- package/templates/base/src/components/content/code-group.tsx +3 -76
- package/templates/base/src/components/content/content-admonition.tsx +4 -56
- package/templates/base/src/config/settings-types.ts +34 -172
- package/templates/base/src/styles/global.css +35 -8
- package/templates/features/i18n/files/pages/[locale]/index.tsx +1 -1
- package/templates/base/pages/404.tsx +0 -61
- package/templates/base/pages/robots.txt.tsx +0 -5
- package/templates/base/pages/sitemap.xml.tsx +0 -59
- package/templates/base/plugins/copy-public-plugin.mjs +0 -58
- package/templates/base/src/components/site-tree-nav.tsx +0 -6
- package/templates/features/docTags/files/pages/[locale]/docs/tags/[tag].tsx +0 -59
- package/templates/features/docTags/files/pages/[locale]/docs/tags/index.tsx +0 -39
- package/templates/features/docTags/files/pages/docs/tags/[tag].tsx +0 -43
- package/templates/features/docTags/files/pages/docs/tags/index.tsx +0 -20
- package/templates/features/versioning/files/pages/[locale]/docs/versions.tsx +0 -48
- package/templates/features/versioning/files/pages/docs/versions.tsx +0 -20
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
// @ts-check
|
|
2
|
-
// zfb plugin module: copy-public.
|
|
3
|
-
//
|
|
4
|
-
// Workaround for upstream zfb gap — `zfb build` does not copy `public/`
|
|
5
|
-
// contents to `outDir`. See: zudolab/zudo-doc#1394;
|
|
6
|
-
// upstream issue: https://github.com/Takazudo/zudo-front-builder/issues/158
|
|
7
|
-
//
|
|
8
|
-
// postBuild — recursively copies `<projectRoot>/public/` directly into
|
|
9
|
-
// `<outDir>/` (FLAT, matching zfb's own dist/ convention —
|
|
10
|
-
// zfb emits dist/index.html, dist/assets/..., NOT
|
|
11
|
-
// dist/<base>/index.html). Under the Workers static assets
|
|
12
|
-
// deploy (base="/"), `dist/` is served at root directly by
|
|
13
|
-
// `wrangler deploy` — no deploy-pipeline relocation step is
|
|
14
|
-
// needed. The `base` option is intentionally unused here.
|
|
15
|
-
//
|
|
16
|
-
// Example: `public/img/logo.svg` becomes `dist/img/logo.svg`,
|
|
17
|
-
// served at `/img/logo.svg` by the Workers static asset layer.
|
|
18
|
-
//
|
|
19
|
-
// Missing or empty `public/` is treated as a no-op (no error).
|
|
20
|
-
//
|
|
21
|
-
// `options` carries `{ publicDir }` from the matching entry in
|
|
22
|
-
// `zfb.config.ts`. The `base` option is intentionally unused — see
|
|
23
|
-
// rationale above.
|
|
24
|
-
|
|
25
|
-
/** @import { ZfbBuildHookContext, ZfbPlugin } from "@takazudo/zfb/plugins" */
|
|
26
|
-
|
|
27
|
-
import { cp } from "node:fs/promises";
|
|
28
|
-
import { resolve } from "node:path";
|
|
29
|
-
|
|
30
|
-
/** @type {ZfbPlugin} */
|
|
31
|
-
export default {
|
|
32
|
-
name: "copy-public",
|
|
33
|
-
|
|
34
|
-
/** @param {ZfbBuildHookContext} ctx */
|
|
35
|
-
async postBuild(ctx) {
|
|
36
|
-
const { publicDir: publicDirOption } = ctx.options;
|
|
37
|
-
const publicDir = resolve(
|
|
38
|
-
ctx.projectRoot,
|
|
39
|
-
typeof publicDirOption === "string" ? publicDirOption : "public",
|
|
40
|
-
);
|
|
41
|
-
const dest = ctx.outDir;
|
|
42
|
-
|
|
43
|
-
ctx.logger.info(`copying ${publicDir} → ${dest}`);
|
|
44
|
-
|
|
45
|
-
await cp(publicDir, dest, {
|
|
46
|
-
recursive: true,
|
|
47
|
-
force: true,
|
|
48
|
-
errorOnExist: false,
|
|
49
|
-
}).catch((/** @type {NodeJS.ErrnoException} */ err) => {
|
|
50
|
-
if (err.code === "ENOENT") {
|
|
51
|
-
// publicDir does not exist or is empty — treat as no-op.
|
|
52
|
-
ctx.logger.info("public/ not found — skipping copy");
|
|
53
|
-
return;
|
|
54
|
-
}
|
|
55
|
-
throw err;
|
|
56
|
-
});
|
|
57
|
-
},
|
|
58
|
-
};
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
// Thin re-export shim. SiteTreeNav moved into the package
|
|
2
|
-
// (`@takazudo/zudo-doc/site-tree-nav-island`) as part of the package-first
|
|
3
|
-
// migration (#2344, S2). Host code using `@/components/site-tree-nav`
|
|
4
|
-
// still resolves correctly; the implementation lives in the package.
|
|
5
|
-
export { SiteTreeNav } from "@takazudo/zudo-doc/site-tree-nav-island";
|
|
6
|
-
export type { SiteTreeNavProps } from "@takazudo/zudo-doc/site-tree-nav-island";
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
/** @jsxRuntime automatic */
|
|
2
|
-
/** @jsxImportSource preact */
|
|
3
|
-
// Page module for the locale-prefixed per-tag detail route.
|
|
4
|
-
//
|
|
5
|
-
// Non-default-locale per-tag detail page. paths() enumerates every
|
|
6
|
-
// (locale, tag) combination across all non-default locales defined in
|
|
7
|
-
// settings.locales, using the same locale-first + base-fallback merge
|
|
8
|
-
// strategy as the Astro original.
|
|
9
|
-
//
|
|
10
|
-
// paths() contract (zfb ADR-004 — synchronous):
|
|
11
|
-
// params: { locale: string; tag: string }
|
|
12
|
-
// props: { tagInfo: TagInfo }
|
|
13
|
-
//
|
|
14
|
-
// Tag collection + rendering are shared with the default-locale route via
|
|
15
|
-
// pages/lib/_tag-pages.tsx (#2010) — this file owns only the param shape.
|
|
16
|
-
// Fallback strategy: see pages/lib/locale-merge.ts for full details.
|
|
17
|
-
|
|
18
|
-
import { settings } from "@/config/settings";
|
|
19
|
-
import type { TagInfo } from "@/utils/tags";
|
|
20
|
-
import type { JSX } from "preact";
|
|
21
|
-
import { collectTagMapForLocale, TagDetailPageView } from "../../../lib/_tag-pages";
|
|
22
|
-
|
|
23
|
-
export const frontmatter = { title: "Tag" };
|
|
24
|
-
|
|
25
|
-
/** One route per (non-default locale, tag) pair. */
|
|
26
|
-
export function paths(): Array<{
|
|
27
|
-
params: { locale: string; tag: string };
|
|
28
|
-
props: { tagInfo: TagInfo };
|
|
29
|
-
}> {
|
|
30
|
-
const result: Array<{
|
|
31
|
-
params: { locale: string; tag: string };
|
|
32
|
-
props: { tagInfo: TagInfo };
|
|
33
|
-
}> = [];
|
|
34
|
-
|
|
35
|
-
for (const locale of Object.keys(settings.locales)) {
|
|
36
|
-
const tagMap = collectTagMapForLocale(locale);
|
|
37
|
-
|
|
38
|
-
for (const [tag, tagInfo] of tagMap.entries()) {
|
|
39
|
-
result.push({
|
|
40
|
-
params: { locale, tag },
|
|
41
|
-
props: { tagInfo },
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
return result;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
interface PageProps {
|
|
50
|
-
params: { locale: string; tag: string };
|
|
51
|
-
tagInfo: TagInfo;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
export default function LocaleDocTagPage({
|
|
55
|
-
params,
|
|
56
|
-
tagInfo,
|
|
57
|
-
}: PageProps): JSX.Element {
|
|
58
|
-
return <TagDetailPageView locale={params.locale} tag={params.tag} tagInfo={tagInfo} />;
|
|
59
|
-
}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
/** @jsxRuntime automatic */
|
|
2
|
-
/** @jsxImportSource preact */
|
|
3
|
-
// Page module for the locale-prefixed "All Tags" index route.
|
|
4
|
-
//
|
|
5
|
-
// Non-default-locale "All Tags" index page. paths() emits one route per
|
|
6
|
-
// locale defined in settings.locales (the default locale has no prefix — it
|
|
7
|
-
// is handled by pages/docs/tags/index.tsx). The component recomputes the tag
|
|
8
|
-
// map at render time using a locale-doc + base-doc fallback strategy
|
|
9
|
-
// (see pages/lib/locale-merge.ts for the merge logic).
|
|
10
|
-
//
|
|
11
|
-
// Tag collection + rendering are shared with the default-locale route via
|
|
12
|
-
// pages/lib/_tag-pages.tsx (#2010).
|
|
13
|
-
//
|
|
14
|
-
// paths() contract (zfb ADR-004 — synchronous):
|
|
15
|
-
// params: { locale: string }
|
|
16
|
-
// props: (none — tag map computed at render time)
|
|
17
|
-
|
|
18
|
-
import { settings } from "@/config/settings";
|
|
19
|
-
import type { JSX } from "preact";
|
|
20
|
-
import { TagsIndexPageView } from "../../../lib/_tag-pages";
|
|
21
|
-
|
|
22
|
-
export const frontmatter = { title: "All Tags" };
|
|
23
|
-
|
|
24
|
-
/** One route per non-default locale (prefixDefaultLocale: false). */
|
|
25
|
-
export function paths(): Array<{ params: { locale: string } }> {
|
|
26
|
-
return Object.keys(settings.locales).map((locale) => ({
|
|
27
|
-
params: { locale },
|
|
28
|
-
}));
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
interface PageProps {
|
|
32
|
-
params: { locale: string };
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export default function LocaleTagsIndexPage({
|
|
36
|
-
params,
|
|
37
|
-
}: PageProps): JSX.Element {
|
|
38
|
-
return <TagsIndexPageView locale={params.locale} />;
|
|
39
|
-
}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
/** @jsxRuntime automatic */
|
|
2
|
-
/** @jsxImportSource preact */
|
|
3
|
-
// Page module for the default-locale per-tag detail route.
|
|
4
|
-
//
|
|
5
|
-
// Default-locale per-tag detail page. paths() enumerates one route per
|
|
6
|
-
// unique tag in the "docs" collection and passes the resolved TagInfo as a
|
|
7
|
-
// prop so the component has zero extra collection reads at render time.
|
|
8
|
-
//
|
|
9
|
-
// paths() contract (zfb ADR-004 — synchronous):
|
|
10
|
-
// params: { tag: string }
|
|
11
|
-
// props: { tagInfo: TagInfo }
|
|
12
|
-
//
|
|
13
|
-
// Tag collection + rendering are shared with the locale-prefixed route via
|
|
14
|
-
// pages/lib/_tag-pages.tsx (#2010) — this file owns only the param shape.
|
|
15
|
-
|
|
16
|
-
import { defaultLocale } from "@/config/i18n";
|
|
17
|
-
import type { TagInfo } from "@/utils/tags";
|
|
18
|
-
import type { JSX } from "preact";
|
|
19
|
-
import { collectTagMapForLocale, TagDetailPageView } from "../../lib/_tag-pages";
|
|
20
|
-
|
|
21
|
-
export const frontmatter = { title: "Tag" };
|
|
22
|
-
|
|
23
|
-
/** One entry per unique tag in the default-locale collection. */
|
|
24
|
-
export function paths(): Array<{
|
|
25
|
-
params: { tag: string };
|
|
26
|
-
props: { tagInfo: TagInfo };
|
|
27
|
-
}> {
|
|
28
|
-
const tagMap = collectTagMapForLocale(defaultLocale);
|
|
29
|
-
|
|
30
|
-
return [...tagMap.entries()].map(([tag, tagInfo]) => ({
|
|
31
|
-
params: { tag },
|
|
32
|
-
props: { tagInfo },
|
|
33
|
-
}));
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
interface PageProps {
|
|
37
|
-
params: { tag: string };
|
|
38
|
-
tagInfo: TagInfo;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
export default function DocTagPage({ params, tagInfo }: PageProps): JSX.Element {
|
|
42
|
-
return <TagDetailPageView locale={defaultLocale} tag={params.tag} tagInfo={tagInfo} />;
|
|
43
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/** @jsxRuntime automatic */
|
|
2
|
-
/** @jsxImportSource preact */
|
|
3
|
-
// Page module for the default-locale "All Tags" index route.
|
|
4
|
-
//
|
|
5
|
-
// Default-locale "All Tags" index page. Collects every tag across the
|
|
6
|
-
// "docs" collection, sorts them alphabetically, and renders a full tag cloud
|
|
7
|
-
// via the v2 TagNav component. No dynamic params — single static route.
|
|
8
|
-
//
|
|
9
|
-
// Tag collection + rendering are shared with the locale-prefixed route via
|
|
10
|
-
// pages/lib/_tag-pages.tsx (#2010).
|
|
11
|
-
|
|
12
|
-
import { defaultLocale } from "@/config/i18n";
|
|
13
|
-
import type { JSX } from "preact";
|
|
14
|
-
import { TagsIndexPageView } from "../../lib/_tag-pages";
|
|
15
|
-
|
|
16
|
-
export const frontmatter = { title: "All Tags" };
|
|
17
|
-
|
|
18
|
-
export default function DocsTagsIndexPage(): JSX.Element {
|
|
19
|
-
return <TagsIndexPageView locale={defaultLocale} />;
|
|
20
|
-
}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
/** @jsxRuntime automatic */
|
|
2
|
-
/** @jsxImportSource preact */
|
|
3
|
-
// Page module for the locale-prefixed versions index route.
|
|
4
|
-
//
|
|
5
|
-
// Non-default-locale versions page. paths() emits one route per locale in
|
|
6
|
-
// settings.locales. Locale string is passed as a prop to drive label
|
|
7
|
-
// translation in the component.
|
|
8
|
-
//
|
|
9
|
-
// Rendering is shared with the default-locale route via
|
|
10
|
-
// pages/lib/_versions-page.tsx (#2010).
|
|
11
|
-
//
|
|
12
|
-
// paths() contract (zfb ADR-004 — synchronous):
|
|
13
|
-
// params: { locale: string }
|
|
14
|
-
// props: { locale }
|
|
15
|
-
|
|
16
|
-
import { settings } from "@/config/settings";
|
|
17
|
-
import type { JSX } from "preact";
|
|
18
|
-
import { VersionsPageView } from "../../lib/_versions-page";
|
|
19
|
-
|
|
20
|
-
export const frontmatter = { title: "Versions" };
|
|
21
|
-
|
|
22
|
-
// ---------------------------------------------------------------------------
|
|
23
|
-
// paths() — synchronous (ADR-004)
|
|
24
|
-
// ---------------------------------------------------------------------------
|
|
25
|
-
|
|
26
|
-
/** One route per non-default locale. */
|
|
27
|
-
export function paths(): Array<{
|
|
28
|
-
params: { locale: string };
|
|
29
|
-
props: { locale: string };
|
|
30
|
-
}> {
|
|
31
|
-
return Object.keys(settings.locales).map((locale) => ({
|
|
32
|
-
params: { locale },
|
|
33
|
-
props: { locale },
|
|
34
|
-
}));
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
// ---------------------------------------------------------------------------
|
|
38
|
-
// Page component
|
|
39
|
-
// ---------------------------------------------------------------------------
|
|
40
|
-
|
|
41
|
-
interface PageArgs {
|
|
42
|
-
params: { locale: string };
|
|
43
|
-
props: { locale: string };
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
export default function LocaleVersionsPage({ params }: PageArgs): JSX.Element {
|
|
47
|
-
return <VersionsPageView locale={params.locale} />;
|
|
48
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/** @jsxRuntime automatic */
|
|
2
|
-
/** @jsxImportSource preact */
|
|
3
|
-
// Page module for the default-locale versions index route.
|
|
4
|
-
//
|
|
5
|
-
// Default-locale documentation versions page. Static route — no paths()
|
|
6
|
-
// export needed. Lists the latest version and any past versions configured
|
|
7
|
-
// in settings.versions.
|
|
8
|
-
//
|
|
9
|
-
// Rendering is shared with the locale-prefixed route via
|
|
10
|
-
// pages/lib/_versions-page.tsx (#2010).
|
|
11
|
-
|
|
12
|
-
import { defaultLocale } from "@/config/i18n";
|
|
13
|
-
import type { JSX } from "preact";
|
|
14
|
-
import { VersionsPageView } from "../lib/_versions-page";
|
|
15
|
-
|
|
16
|
-
export const frontmatter = { title: "Versions" };
|
|
17
|
-
|
|
18
|
-
export default function VersionsPage(): JSX.Element {
|
|
19
|
-
return <VersionsPageView locale={defaultLocale} />;
|
|
20
|
-
}
|