create-zudo-doc 0.2.21 → 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.
Files changed (92) hide show
  1. package/dist/compose.d.ts +6 -3
  2. package/dist/compose.js +6 -4
  3. package/dist/features/image-enlarge.d.ts +22 -12
  4. package/dist/features/image-enlarge.js +23 -191
  5. package/dist/scaffold.d.ts +11 -0
  6. package/dist/scaffold.js +51 -24
  7. package/dist/settings-gen.js +4 -0
  8. package/dist/zfb-config-gen.d.ts +16 -10
  9. package/dist/zfb-config-gen.js +34 -239
  10. package/package.json +1 -1
  11. package/templates/base/pages/_mdx-components.ts +64 -185
  12. package/templates/base/pages/index.tsx +1 -1
  13. package/templates/base/pages/lib/_body-end-islands.tsx +6 -13
  14. package/templates/base/pages/lib/_category-nav.tsx +30 -115
  15. package/templates/base/pages/lib/_category-tree-nav.tsx +38 -65
  16. package/templates/base/pages/lib/_compose-meta-title.ts +2 -6
  17. package/templates/base/pages/lib/_doc-body-end.tsx +3 -35
  18. package/templates/base/pages/lib/_doc-content-header.tsx +10 -111
  19. package/templates/base/pages/lib/_doc-history-area.tsx +19 -211
  20. package/templates/base/pages/lib/_doc-metainfo-area.tsx +10 -113
  21. package/templates/base/pages/lib/_doc-page-renderer.tsx +22 -183
  22. package/templates/base/pages/lib/_doc-page-shell.tsx +17 -251
  23. package/templates/base/pages/lib/_doc-pager.tsx +4 -74
  24. package/templates/base/pages/lib/_doc-route-entries.ts +43 -177
  25. package/templates/base/pages/lib/_doc-route-paths.ts +16 -101
  26. package/templates/base/pages/lib/_doc-tags-area.tsx +14 -77
  27. package/templates/base/pages/lib/_extract-headings.ts +21 -295
  28. package/templates/base/pages/lib/_footer-with-defaults.tsx +37 -225
  29. package/templates/base/pages/lib/_frontmatter-preview-data.ts +5 -31
  30. package/templates/base/pages/lib/_head-with-defaults.tsx +13 -138
  31. package/templates/base/pages/lib/_header-with-defaults.tsx +24 -324
  32. package/templates/base/pages/lib/_inline-version-switcher.tsx +16 -78
  33. package/templates/base/pages/lib/_math-block.tsx +4 -63
  34. package/templates/base/pages/lib/_nav-data-prep.ts +32 -51
  35. package/templates/base/pages/lib/_nav-source-cache.ts +12 -57
  36. package/templates/base/pages/lib/_nav-source-docs.ts +33 -233
  37. package/templates/base/pages/lib/_search-widget-script.ts +2 -470
  38. package/templates/base/pages/lib/_search-widget.tsx +9 -195
  39. package/templates/base/pages/lib/_sidebar-prepaint.tsx +6 -59
  40. package/templates/base/pages/lib/_sidebar-with-defaults.tsx +16 -118
  41. package/templates/base/pages/lib/_site-tree-nav.tsx +29 -80
  42. package/templates/base/pages/lib/doc-page-props.ts +26 -44
  43. package/templates/base/pages/lib/locale-merge.ts +32 -145
  44. package/templates/base/pages/lib/route-enumerators.ts +52 -286
  45. package/templates/base/src/components/ai-chat-modal.tsx +9 -8
  46. package/templates/base/src/components/content/code-group.tsx +3 -76
  47. package/templates/base/src/components/content/content-admonition.tsx +4 -56
  48. package/templates/base/src/components/doc-history.tsx +9 -8
  49. package/templates/base/src/components/image-enlarge.tsx +11 -8
  50. package/templates/base/src/components/sidebar-toggle.tsx +6 -170
  51. package/templates/base/src/components/sidebar-tree.tsx +6 -548
  52. package/templates/base/src/config/color-scheme-utils.ts +34 -158
  53. package/templates/base/src/config/i18n.ts +9 -0
  54. package/templates/base/src/config/settings-types.ts +34 -172
  55. package/templates/base/src/config/z-index-tokens.ts +5 -4
  56. package/templates/base/src/styles/global.css +40 -587
  57. package/templates/base/src/utils/base.ts +1 -1
  58. package/templates/base/src/utils/docs.ts +47 -16
  59. package/templates/base/src/utils/github.ts +12 -9
  60. package/templates/base/src/utils/nav-scope.ts +13 -42
  61. package/templates/base/src/utils/sidebar.ts +18 -86
  62. package/templates/base/src/utils/slug.ts +10 -53
  63. package/templates/base/src/utils/smart-break.tsx +12 -120
  64. package/templates/base/src/utils/tags.ts +25 -68
  65. package/templates/features/bodyFootUtil/files/src/utils/github.ts +12 -9
  66. package/templates/features/designTokenPanel/files/src/lib/design-token-panel-bootstrap.ts +13 -39
  67. package/templates/features/docHistory/files/src/components/doc-history.tsx +8 -636
  68. package/templates/features/docHistory/files/src/types/doc-history.ts +7 -23
  69. package/templates/features/docTags/files/pages/lib/_tag-pages.tsx +35 -201
  70. package/templates/features/i18n/files/pages/[locale]/index.tsx +1 -1
  71. package/templates/features/imageEnlarge/files/src/components/image-enlarge.tsx +8 -269
  72. package/templates/features/sidebarToggle/files/src/components/desktop-sidebar-toggle.tsx +6 -99
  73. package/templates/features/tagGovernance/files/scripts/tags-audit.ts +67 -515
  74. package/templates/features/versioning/files/pages/lib/_versions-page.tsx +21 -73
  75. package/templates/base/pages/404.tsx +0 -61
  76. package/templates/base/pages/robots.txt.tsx +0 -29
  77. package/templates/base/pages/sitemap.xml.tsx +0 -59
  78. package/templates/base/plugins/connect-adapter.mjs +0 -169
  79. package/templates/base/plugins/copy-public-plugin.mjs +0 -58
  80. package/templates/base/plugins/search-index-plugin.mjs +0 -66
  81. package/templates/base/scripts/gen-z-index.mjs +0 -157
  82. package/templates/base/src/components/mermaid-enlarge.tsx +0 -490
  83. package/templates/base/src/components/site-tree-nav.tsx +0 -220
  84. package/templates/features/claudeResources/files/plugins/claude-resources-plugin.mjs +0 -47
  85. package/templates/features/docHistory/files/plugins/doc-history-plugin.mjs +0 -111
  86. package/templates/features/docTags/files/pages/[locale]/docs/tags/[tag].tsx +0 -59
  87. package/templates/features/docTags/files/pages/[locale]/docs/tags/index.tsx +0 -39
  88. package/templates/features/docTags/files/pages/docs/tags/[tag].tsx +0 -43
  89. package/templates/features/docTags/files/pages/docs/tags/index.tsx +0 -20
  90. package/templates/features/llmsTxt/files/plugins/llms-txt-plugin.mjs +0 -93
  91. package/templates/features/versioning/files/pages/[locale]/docs/versions.tsx +0 -48
  92. package/templates/features/versioning/files/pages/docs/versions.tsx +0 -20
package/dist/compose.d.ts CHANGED
@@ -75,9 +75,6 @@ export declare function validateDependencies(features: FeatureDefinition[], allS
75
75
  * `@import "@takazudo/zdtp/styles.css";` at `@slot:global-css:feature-styles`.
76
76
  * The sibling `@slot:global-css:theme-tokens` anchor is consumed by the
77
77
  * color-scheme palette generator and must remain.
78
- * - `pages/_mdx-components.ts` — image-enlarge.ts injects the
79
- * EnlargeableParagraph p-override (ENLARGE_SVG, EnlargeableParagraph def,
80
- * `p:` map entry) when imageEnlarge is enabled.
81
78
  * - `pages/lib/_body-end-islands.tsx` — tauri.ts injects the FindInPageInit
82
79
  * island (import, displayName, Island mount) when tauri is enabled.
83
80
  * design-token-panel.ts injects the DesignTokenPanelBootstrap island
@@ -86,6 +83,12 @@ export declare function validateDependencies(features: FeatureDefinition[], allS
86
83
  * - `src/config/settings-types.ts` — design-token-panel.ts injects the
87
84
  * `"design-token-panel"` member into `HeaderRightTriggerName` when the
88
85
  * feature is enabled (replace-range between the :start/:end anchors).
86
+ *
87
+ * NOTE: `pages/_mdx-components.ts` was removed (#2360 / E2). The imageEnlarge
88
+ * p-override injections (ENLARGE_SVG, EnlargeableParagraph, p: entry) are now
89
+ * handled inside the @takazudo/zudo-doc/mdx-components factory — the template
90
+ * no longer carries @slot anchors for this file and the feature module's
91
+ * injections are a no-op (the factory reads settings.imageEnlarge at render time).
89
92
  */
90
93
  export declare const ANCHOR_FILES: string[];
91
94
  /**
package/dist/compose.js CHANGED
@@ -161,9 +161,6 @@ export function validateDependencies(features, allSelectedNames) {
161
161
  * `@import "@takazudo/zdtp/styles.css";` at `@slot:global-css:feature-styles`.
162
162
  * The sibling `@slot:global-css:theme-tokens` anchor is consumed by the
163
163
  * color-scheme palette generator and must remain.
164
- * - `pages/_mdx-components.ts` — image-enlarge.ts injects the
165
- * EnlargeableParagraph p-override (ENLARGE_SVG, EnlargeableParagraph def,
166
- * `p:` map entry) when imageEnlarge is enabled.
167
164
  * - `pages/lib/_body-end-islands.tsx` — tauri.ts injects the FindInPageInit
168
165
  * island (import, displayName, Island mount) when tauri is enabled.
169
166
  * design-token-panel.ts injects the DesignTokenPanelBootstrap island
@@ -172,10 +169,15 @@ export function validateDependencies(features, allSelectedNames) {
172
169
  * - `src/config/settings-types.ts` — design-token-panel.ts injects the
173
170
  * `"design-token-panel"` member into `HeaderRightTriggerName` when the
174
171
  * feature is enabled (replace-range between the :start/:end anchors).
172
+ *
173
+ * NOTE: `pages/_mdx-components.ts` was removed (#2360 / E2). The imageEnlarge
174
+ * p-override injections (ENLARGE_SVG, EnlargeableParagraph, p: entry) are now
175
+ * handled inside the @takazudo/zudo-doc/mdx-components factory — the template
176
+ * no longer carries @slot anchors for this file and the feature module's
177
+ * injections are a no-op (the factory reads settings.imageEnlarge at render time).
175
178
  */
176
179
  export const ANCHOR_FILES = [
177
180
  "src/styles/global.css",
178
- "pages/_mdx-components.ts",
179
181
  "pages/lib/_body-end-islands.tsx",
180
182
  "src/config/settings-types.ts",
181
183
  ];
@@ -5,18 +5,28 @@ import type { FeatureModule } from "../compose.js";
5
5
  * W7A (#1736): post-cutover, the image-enlarge island is mounted by the
6
6
  * pages/lib body-end wrapper (always present; runtime-gated via the
7
7
  * always-loaded stub-or-real ImageEnlarge component). Image-enlarge CSS
8
- * lives unconditionally in `templates/base/src/styles/global.css` the
9
- * selectors only activate when the runtime mounts the .zd-enlarge-btn.
8
+ * lives unconditionally in `@takazudo/zudo-doc/features.css` (moved from
9
+ * `global.css` in S3 #2348) — the selectors only activate when the runtime
10
+ * mounts the .zd-enlarge-btn.
10
11
  *
11
- * S2 (#1825): after zfb next.18 removed the built-in imageEnlarge Rust
12
- * feature, the server-side figure/button emission is re-implemented via an
13
- * MDX paragraph (p) component override in pages/_mdx-components.ts. When
14
- * imageEnlarge is enabled, three injections into the template file install:
15
- * 1. Additional imports: toChildArray + VNode from preact.
16
- * 2. ENLARGE_SVG const + EnlargeableParagraph function definition.
17
- * 3. `p: EnlargeableParagraph` entry in the createMdxComponents return map.
18
- * When imageEnlarge is OFF, none of these are injected, so the override is
19
- * absent and paragraphs render plain (the Rust built-in is gone "off" must
20
- * mean no wrapping at all).
12
+ * S2 (#1825): the server-side figure/button emission was re-implemented via an
13
+ * MDX paragraph (p) component override in pages/_mdx-components.ts. Three
14
+ * injections installed the ENLARGE_SVG + EnlargeableParagraph code when
15
+ * imageEnlarge was enabled.
16
+ *
17
+ * S8 / #2360 (E2): the full MDX component assembly moved into the
18
+ * @takazudo/zudo-doc/mdx-components factory (createMdxComponentsBase). The
19
+ * factory reads settings.imageEnlarge at render time and conditionally wraps
20
+ * block-level images in <figure class="zd-enlargeable"> the same logic the
21
+ * old injections installed, now handled once inside the package. The three
22
+ * _mdx-components.ts injections (enlarge-imports, enlarge-defs,
23
+ * enlarge-p-entry) are therefore removed; the feature is a no-op from the
24
+ * compose engine's perspective (the runtime gate in the factory is always
25
+ * present in the scaffolded template).
26
+ *
27
+ * S3 (#2348): the ImageEnlarge island and its SSR fallback moved from
28
+ * src/components/image-enlarge.tsx into @takazudo/zudo-doc/image-enlarge.
29
+ * The pages/lib/_body-end-islands.tsx template now imports them from the
30
+ * package, so no file-copy injections exist in this feature module either.
21
31
  */
22
32
  export declare const imageEnlargeFeature: FeatureModule;
@@ -4,199 +4,31 @@
4
4
  * W7A (#1736): post-cutover, the image-enlarge island is mounted by the
5
5
  * pages/lib body-end wrapper (always present; runtime-gated via the
6
6
  * always-loaded stub-or-real ImageEnlarge component). Image-enlarge CSS
7
- * lives unconditionally in `templates/base/src/styles/global.css` the
8
- * selectors only activate when the runtime mounts the .zd-enlarge-btn.
7
+ * lives unconditionally in `@takazudo/zudo-doc/features.css` (moved from
8
+ * `global.css` in S3 #2348) — the selectors only activate when the runtime
9
+ * mounts the .zd-enlarge-btn.
9
10
  *
10
- * S2 (#1825): after zfb next.18 removed the built-in imageEnlarge Rust
11
- * feature, the server-side figure/button emission is re-implemented via an
12
- * MDX paragraph (p) component override in pages/_mdx-components.ts. When
13
- * imageEnlarge is enabled, three injections into the template file install:
14
- * 1. Additional imports: toChildArray + VNode from preact.
15
- * 2. ENLARGE_SVG const + EnlargeableParagraph function definition.
16
- * 3. `p: EnlargeableParagraph` entry in the createMdxComponents return map.
17
- * When imageEnlarge is OFF, none of these are injected, so the override is
18
- * absent and paragraphs render plain (the Rust built-in is gone — "off" must
19
- * mean no wrapping at all).
20
- */
21
- export const imageEnlargeFeature = () => ({
22
- name: "imageEnlarge",
23
- injections: [
24
- // 1. Import additions: toChildArray + VNode from preact.
25
- // Inserted AFTER the `// @slot:mdx-components:enlarge-imports` anchor.
26
- // NOTE: `settings` is NOT injected here — the base template already
27
- // imports it (#2172); injecting it again caused a duplicate ES-module
28
- // lexical binding.
29
- {
30
- file: "pages/_mdx-components.ts",
31
- anchor: "// @slot:mdx-components:enlarge-imports",
32
- position: "after",
33
- content: `import { toChildArray } from "preact";
34
- import type { VNode } from "preact";`,
35
- },
36
- // 2. ENLARGE_SVG const + EnlargeableParagraph function.
37
- // Inserted AFTER the `// @slot:mdx-components:enlarge-defs` anchor
38
- // (which sits just before the `createMdxComponents` JSDoc comment).
39
- // Markup is ported verbatim from rehype-image-enlarge.ts makeEnlargeButton()
40
- // so the island's eligibility/[hidden] logic and CSS keep working identically.
41
- {
42
- file: "pages/_mdx-components.ts",
43
- anchor: "// @slot:mdx-components:enlarge-defs",
44
- position: "after",
45
- content: `/**
46
- * SVG icon for the image-enlarge button (4-corner-arrows).
47
- *
48
- * Ported verbatim from
49
- * packages/create-zudo-doc/templates/base/src/plugins/rehype-image-enlarge.ts
50
- * makeEnlargeButton() — this is the same icon the old Rust plugin emitted.
51
- * Must match exactly so the existing .zd-enlarge-btn CSS and the
52
- * image-enlarge island (src/components/image-enlarge.tsx) keep working.
53
- *
54
- * Attribute spellings: HTML/Preact conventions — \`focusable\` stays a string
55
- * ("false") because Preact's preact-render-to-string drops boolean false;
56
- * \`aria-hidden\` is the HTML attribute name (not ariaHidden).
57
- */
58
- const ENLARGE_SVG = {
59
- type: "svg",
60
- props: {
61
- viewBox: "0 0 38.99 38.99",
62
- fill: "currentColor",
63
- focusable: "false",
64
- "aria-hidden": "true",
65
- children: [
66
- {
67
- type: "polygon",
68
- props: {
69
- points:
70
- "16.2 13.74 5.92 3.47 11.2 3.47 11.2 0 3.47 0 0 0 0 3.47 0 11.2 3.47 11.2 3.47 5.92 13.74 16.2 16.2 13.74",
71
- },
72
- key: null,
73
- constructor: undefined,
74
- },
75
- {
76
- type: "polygon",
77
- props: {
78
- points:
79
- "25.24 16.2 35.52 5.92 35.52 11.2 38.99 11.2 38.99 3.47 38.99 0 35.52 0 27.79 0 27.79 3.47 33.07 3.47 22.79 13.74 25.24 16.2",
80
- },
81
- key: null,
82
- constructor: undefined,
83
- },
84
- {
85
- type: "polygon",
86
- props: {
87
- points:
88
- "22.79 25.24 33.07 35.52 27.79 35.52 27.79 38.99 35.52 38.99 38.99 38.99 38.99 35.52 38.99 27.79 35.52 27.79 35.52 33.07 25.24 22.79 22.79 25.24",
89
- },
90
- key: null,
91
- constructor: undefined,
92
- },
93
- {
94
- type: "polygon",
95
- props: {
96
- points:
97
- "13.74 22.79 3.47 33.07 3.47 27.79 0 27.79 0 35.52 0 38.99 3.47 38.99 11.2 38.99 11.2 35.52 5.92 35.52 16.2 25.24 13.74 22.79",
98
- },
99
- key: null,
100
- constructor: undefined,
101
- },
102
- ],
103
- },
104
- key: null,
105
- constructor: undefined,
106
- };
107
-
108
- /**
109
- * Enlarge-aware MDX paragraph override.
110
- *
111
- * When \`settings.imageEnlarge\` is enabled and a paragraph contains exactly
112
- * one non-whitespace child that is a block-level image VNode (type ===
113
- * ContentImg or "img"), this wraps the image in:
114
- * <figure class="zd-enlargeable">
115
- * <img ...>
116
- * <button type="button" class="zd-enlarge-btn" hidden aria-label="Enlarge image">
117
- * <svg ...>…</svg>
118
- * </button>
119
- * </figure>
11
+ * S2 (#1825): the server-side figure/button emission was re-implemented via an
12
+ * MDX paragraph (p) component override in pages/_mdx-components.ts. Three
13
+ * injections installed the ENLARGE_SVG + EnlargeableParagraph code when
14
+ * imageEnlarge was enabled.
120
15
  *
121
- * The \`title="no-enlarge"\` opt-out is read from the un-rendered VNode
122
- * (Preact's h() is lazy — child.type is still the ContentImg function, not
123
- * yet called). ContentImg strips the sentinel from the rendered img DOM.
16
+ * S8 / #2360 (E2): the full MDX component assembly moved into the
17
+ * @takazudo/zudo-doc/mdx-components factory (createMdxComponentsBase). The
18
+ * factory reads settings.imageEnlarge at render time and conditionally wraps
19
+ * block-level images in <figure class="zd-enlargeable"> — the same logic the
20
+ * old injections installed, now handled once inside the package. The three
21
+ * _mdx-components.ts injections (enlarge-imports, enlarge-defs,
22
+ * enlarge-p-entry) are therefore removed; the feature is a no-op from the
23
+ * compose engine's perspective (the runtime gate in the factory is always
24
+ * present in the scaffolded template).
124
25
  *
125
- * All other paragraphs delegate to htmlOverrides.p (ContentParagraph passthrough).
26
+ * S3 (#2348): the ImageEnlarge island and its SSR fallback moved from
27
+ * src/components/image-enlarge.tsx into @takazudo/zudo-doc/image-enlarge.
28
+ * The pages/lib/_body-end-islands.tsx template now imports them from the
29
+ * package, so no file-copy injections exist in this feature module either.
126
30
  */
127
- function EnlargeableParagraph(props: {
128
- children?: ComponentChildren;
129
- [key: string]: unknown;
130
- }): unknown {
131
- const { children, ...rest } = props;
132
- // Collect children and drop whitespace-only text nodes.
133
- const kids = toChildArray(children).filter((child) => {
134
- if (typeof child === "string" || typeof child === "number") {
135
- return String(child).trim() !== "";
136
- }
137
- return true;
138
- });
139
-
140
- // Check for a single-image block paragraph eligible for enlarge wrapping.
141
- if (settings.imageEnlarge && kids.length === 1) {
142
- const kid = kids[0];
143
- // VNode type guard: must be an object with a \`type\` property.
144
- if (
145
- kid !== null &&
146
- typeof kid === "object" &&
147
- "type" in kid &&
148
- "props" in kid
149
- ) {
150
- const vnode = kid as VNode<Record<string, unknown>>;
151
- if (vnode.type === ContentImg || vnode.type === "img") {
152
- const imgProps = (vnode.props ?? {}) as Record<string, unknown>;
153
- // Opt-out: title="no-enlarge" — render plain paragraph (ContentImg
154
- // will strip the sentinel title from the actual img DOM).
155
- if (imgProps.title !== "no-enlarge") {
156
- // Wrap in figure.zd-enlargeable with the enlarge button.
157
- const enlargeBtn = {
158
- type: "button",
159
- props: {
160
- type: "button",
161
- class: "zd-enlarge-btn",
162
- hidden: true,
163
- "aria-label": "Enlarge image",
164
- children: ENLARGE_SVG,
165
- },
166
- key: null,
167
- constructor: undefined,
168
- };
169
- return {
170
- type: "figure",
171
- props: {
172
- class: "zd-enlargeable",
173
- children: [vnode, enlargeBtn],
174
- },
175
- key: null,
176
- constructor: undefined,
177
- };
178
- }
179
- }
180
- }
181
- }
182
-
183
- // Fallback: delegate to the standard ContentParagraph passthrough.
184
- return (htmlOverrides.p as (props: unknown) => unknown)(props);
185
- }
186
- `,
187
- },
188
- // 3. p: EnlargeableParagraph entry in createMdxComponents return map.
189
- // Inserted AFTER the `// @slot:mdx-components:enlarge-p-entry` anchor
190
- // (which sits between `img: ContentImg,` and `HtmlPreview:`).
191
- // Must come AFTER the ...htmlOverrides spread to override ContentParagraph.
192
- {
193
- file: "pages/_mdx-components.ts",
194
- anchor: "// @slot:mdx-components:enlarge-p-entry",
195
- position: "after",
196
- content: ` // p override: wraps block-level images in <figure class="zd-enlargeable">
197
- // with an enlarge button when settings.imageEnlarge is enabled.
198
- // Must come AFTER the ...htmlOverrides spread to override ContentParagraph.
199
- p: EnlargeableParagraph,`,
200
- },
201
- ],
31
+ export const imageEnlargeFeature = () => ({
32
+ name: "imageEnlarge",
33
+ injections: [],
202
34
  });
@@ -1,4 +1,15 @@
1
1
  import type { UserChoices } from "./prompts.js";
2
2
  import { getSecondaryLang } from "./utils.js";
3
3
  export { getSecondaryLang };
4
+ /**
5
+ * Pinned `@takazudo/zudo-doc` version used in both `generatePackageJson()`
6
+ * and the `.zudo-doc.json` seed written by `scaffold()`. Hoisted as a shared
7
+ * constant so the dep pin and the provenance seed can never drift.
8
+ *
9
+ * Strip the caret from this string to get the bare version for provenance:
10
+ * ZUDO_DOC_PIN.replace(/^\^/, "") → "1.0.0"
11
+ *
12
+ * Bumped in lockstep by scripts/release-create-zudo-doc.sh.
13
+ */
14
+ export declare const ZUDO_DOC_PIN = "^1.0.0";
4
15
  export declare function scaffold(choices: UserChoices): Promise<void>;
package/dist/scaffold.js CHANGED
@@ -8,6 +8,17 @@ import { composeFeatures } from "./compose.js";
8
8
  import { featureModules } from "./features/index.js";
9
9
  import { capitalize, getSecondaryLang } from "./utils.js";
10
10
  export { getSecondaryLang };
11
+ /**
12
+ * Pinned `@takazudo/zudo-doc` version used in both `generatePackageJson()`
13
+ * and the `.zudo-doc.json` seed written by `scaffold()`. Hoisted as a shared
14
+ * constant so the dep pin and the provenance seed can never drift.
15
+ *
16
+ * Strip the caret from this string to get the bare version for provenance:
17
+ * ZUDO_DOC_PIN.replace(/^\^/, "") → "1.0.0"
18
+ *
19
+ * Bumped in lockstep by scripts/release-create-zudo-doc.sh.
20
+ */
21
+ export const ZUDO_DOC_PIN = "^1.0.0";
11
22
  /**
12
23
  * Files in `templates/base/**` that must never be copied into a generated
13
24
  * project. Each entry is matched against the path relative to `templates/base/`
@@ -280,6 +291,14 @@ export async function scaffold(choices) {
280
291
  await fs.outputFile(path.join(targetDir, "zfb.config.ts"), zfbConfigContent);
281
292
  const pkg = generatePackageJson(choices);
282
293
  await fs.outputFile(path.join(targetDir, "package.json"), JSON.stringify(pkg, null, 2) + "\n");
294
+ // Seed .zudo-doc.json — provenance marker for `zudo-doc eject <component>`.
295
+ // packageVersion is the bare version string (caret stripped from ZUDO_DOC_PIN)
296
+ // so it records the concrete version the scaffold targets; the eject CLI
297
+ // records the actually-installed version on first eject.
298
+ await fs.outputFile(path.join(targetDir, ".zudo-doc.json"), JSON.stringify({
299
+ packageVersion: ZUDO_DOC_PIN.replace(/^\^/, ""),
300
+ ejected: {},
301
+ }, null, 2) + "\n");
283
302
  const gitignoreLines = [
284
303
  "# Build output",
285
304
  "node_modules",
@@ -303,6 +322,9 @@ export async function scaffold(choices) {
303
322
  "# Cloudflare Wrangler",
304
323
  ".wrangler/",
305
324
  "",
325
+ "# zudo-doc build artifact (routes-src/ staged here at build time)",
326
+ ".zudo-doc/",
327
+ "",
306
328
  ];
307
329
  // The doc-lookup skill is only generated when skillSymlinker is selected
308
330
  // (the setup-doc-skill.sh script and `setup:doc-skill` npm script are gated
@@ -444,15 +466,20 @@ function generatePackageJson(choices) {
444
466
  // zfb-content GFM-autolink fix — terminate the autolink path at CJK
445
467
  // boundaries (zfb#1105). Content-rendering bug fix, additive; relevant for
446
468
  // CJK (e.g. Japanese) docs. No consumer-facing / CLI breaking change.
447
- // next.54 (current pin): bug-fix + perf release — cross-OS CSS hash
448
- // stability, multi-valued response headers (e.g. multiple Set-Cookie),
469
+ // next.54: bug-fix + perf release — cross-OS CSS hash stability,
470
+ // multi-valued response headers (e.g. multiple Set-Cookie),
449
471
  // supplementary-plane CJK reading-time, plus CLI/server/runtime hardening
450
472
  // and render perf passes. No consumer-facing / CLI breaking change.
451
- "@takazudo/zfb": "0.1.0-next.59",
452
- "@takazudo/zfb-runtime": "0.1.0-next.59",
473
+ // next.65 (current pin): dev-render of package-injected routes (zfb#1227,
474
+ // landed next.63) + islands bundler now seeds the host tsconfig `paths`
475
+ // (e.g. `@/*`) into its synthetic tsconfig (zfb#1238) — fixes silent island
476
+ // hydration failure under route injection. Unblocks packageOwnedRoutes.
477
+ // No consumer-facing / CLI breaking change.
478
+ "@takazudo/zfb": "0.1.0-next.65",
479
+ "@takazudo/zfb-runtime": "0.1.0-next.65",
453
480
  // zfb-adapter-cloudflare — required for any route with `prerender = false`.
454
481
  // Pinned in lockstep with @takazudo/zfb.
455
- "@takazudo/zfb-adapter-cloudflare": "0.1.0-next.59",
482
+ "@takazudo/zfb-adapter-cloudflare": "0.1.0-next.65",
456
483
  // @takazudo/zudo-doc — published from this monorepo via
457
484
  // .github/workflows/publish-zudo-doc.yml. The pin here is bumped in
458
485
  // lockstep by scripts/release-create-zudo-doc.sh whenever zudo-doc's
@@ -464,7 +491,9 @@ function generatePackageJson(choices) {
464
491
  // ties this pin to packages/zudo-doc's version, so the lockstep release
465
492
  // bumps both together; do not cut a create-zudo-doc release until the
466
493
  // matching @takazudo/zudo-doc version (with content.css) is on npm.
467
- "@takazudo/zudo-doc": "^0.2.21",
494
+ // ZUDO_DOC_PIN is the shared constant — scaffold() uses the same value
495
+ // to seed .zudo-doc.json so the provenance and the dep can never drift.
496
+ "@takazudo/zudo-doc": ZUDO_DOC_PIN,
468
497
  // zod — used by the generated zfb.config.ts. zfb-config-gen emits
469
498
  // `import { z } from "zod"` for the content-collection schema +
470
499
  // `z.toJSONSchema(...)` conversion. Without this dep, the consumer
@@ -514,27 +543,22 @@ function generatePackageJson(choices) {
514
543
  deps["diff"] = "^8.0.3";
515
544
  // @takazudo/zudo-doc has @takazudo/zudo-doc-history-server as an optional
516
545
  // peer dep. When docHistory is selected the zfb plugin
517
- // (plugins/doc-history-plugin.mjs) eagerly imports
546
+ // (@takazudo/zudo-doc/plugins/doc-history) eagerly imports
518
547
  // @takazudo/zudo-doc/integrations/doc-history which in turn imports
519
548
  // @takazudo/zudo-doc-history-server/git-history. Without this dep the
520
549
  // plugin host fails at init with ERR_MODULE_NOT_FOUND — W8A (#1739).
521
- deps["@takazudo/zudo-doc-history-server"] = "^0.2.21";
522
- // W7A (#1736): doc-history-plugin.mjs spawns `tsx -e <inline-script>` to
523
- // run the v2 runtime in a TS-aware Node subprocess; without tsx the
524
- // plugin's preBuild step exits with ENOENT before zfb finishes config
525
- // load.
526
- devDeps["tsx"] = "^4.21.0";
527
- }
528
- if (choices.features.includes("claudeResources")) {
529
- // W7A (#1736): claude-resources-plugin.mjs spawns `tsx -e <inline-script>`
530
- // for the same reason as doc-history (TS-aware Node subprocess wrapping
531
- // the v2 runner).
532
- devDeps["tsx"] = "^4.21.0";
550
+ deps["@takazudo/zudo-doc-history-server"] = "^1.0.0";
551
+ // tsx is no longer needed here: the relocated package plugin imports the
552
+ // runner directly (no `tsx -e` spawn) since the package ships compiled
553
+ // dist/ package-first migration #2321 (#2337).
533
554
  }
555
+ // claudeResources: tsx is no longer needed. The relocated package plugin
556
+ // (@takazudo/zudo-doc/plugins/claude-resources) imports the runner directly
557
+ // since the package ships compiled dist/ — package-first migration #2321 (#2337).
534
558
  if (choices.features.includes("designTokenPanel")) {
535
559
  // @takazudo/zdtp requires preact >= 10.29.1 — see the preact floor comment
536
560
  // above (~line 382) for why the floor is set there and the coupling this creates.
537
- deps["@takazudo/zdtp"] = "0.2.3";
561
+ deps["@takazudo/zdtp"] = "0.3.3";
538
562
  }
539
563
  if (choices.features.includes("tagGovernance")) {
540
564
  // gray-matter is already in `deps` unconditionally (base template uses it),
@@ -561,12 +585,15 @@ function generatePackageJson(choices) {
561
585
  // Z-index token codegen (#2148): regenerate the GENERATED:Z_INDEX @theme
562
586
  // block in src/styles/global.css from src/config/z-index-tokens.ts, and a
563
587
  // drift check for pre-push/CI. Both ship in base — the z-index token system
564
- // is part of every scaffold.
565
- "gen:z-index": "node scripts/gen-z-index.mjs",
566
- "check:z-index": "node scripts/gen-z-index.mjs --check",
588
+ // is part of every scaffold. Bin provided by @takazudo/zudo-doc (S9b #2334).
589
+ "gen:z-index": "gen-z-index",
590
+ "check:z-index": "gen-z-index --check",
567
591
  };
568
592
  if (choices.features.includes("tagGovernance")) {
569
- scripts["tags:audit"] = "tsx scripts/tags-audit.ts";
593
+ // tags-audit bin is provided by @takazudo/zudo-doc (S9b #2334);
594
+ // tsx is still required as a devDep because the bin's runner imports
595
+ // the project's TypeScript config files at runtime via tsx.
596
+ scripts["tags:audit"] = "tags-audit";
570
597
  scripts["tags:suggest"] = "tsx scripts/tags-suggest.ts";
571
598
  }
572
599
  if (choices.features.includes("skillSymlinker")) {
@@ -150,6 +150,10 @@ export function generateSettingsFile(choices) {
150
150
  else {
151
151
  lines.push(` docHistory: false,`);
152
152
  }
153
+ // Package-owned route injection is on by default since the fast-follow (#2372).
154
+ // Generated projects include the field explicitly so settings.ts stays in sync
155
+ // with src/config/settings.ts (checked by check-fixture-settings-drift.mjs).
156
+ lines.push(` packageOwnedRoutes: true,`);
153
157
  if (choices.features.includes("bodyFootUtil")) {
154
158
  lines.push(` bodyFootUtilArea: {`);
155
159
  lines.push(` docHistory: ${choices.features.includes("docHistory")},`);
@@ -2,18 +2,24 @@ import type { UserChoices } from "./prompts.js";
2
2
  /**
3
3
  * Programmatically generate zfb.config.ts from user choices.
4
4
  *
5
- * W7A (#1736): emits zfb plugins in the host's INLINE-OBJECT shape
6
- * `{ name: "./plugins/<plugin>.mjs", options: {...} }` — not the
7
- * pre-cutover factory-import pattern (`import { fooPlugin } from
8
- * "./src/integrations/foo"`). Inline functions are not supported by zfb's
9
- * plugin runtime (see `@takazudo/zfb/plugins` source); plugins MUST be
10
- * authored as standalone `.mjs` modules referenced from `zfb.config.ts`
11
- * by `name`. The plugin source files are shipped by the base/feature
12
- * templates under `plugins/<plugin>.mjs` and `templates/features/<feature>/
13
- * files/plugins/<plugin>.mjs`.
5
+ * S5b (#2329): collapsed to the thin preset-based shape that mirrors the
6
+ * showcase `zfb.config.ts` after S5a. All collection wiring, plugin
7
+ * descriptors, markdown features, codeHighlight, resolveMarkdownLinks, and
8
+ * trailingSlash are now owned by `zudoDocPreset()` in
9
+ * `@takazudo/zudo-doc/preset`. The generated config spreads the preset
10
+ * result into `defineConfig` and keeps only the project-owned shell fields
11
+ * (`framework`, `port`, `tailwind`, `base`).
14
12
  *
15
13
  * Replaces the former astro-config-gen.ts + content-config-gen.ts pair.
16
14
  * In the zfb world, content-collection schemas live inside zfb.config.ts
17
15
  * itself — there is no separate content.config.ts.
16
+ *
17
+ * `_choices` is intentionally unused: post-S5b the emitted config is a
18
+ * CONSTANT. All feature variation is driven by `settings.*` (read at
19
+ * zfb-load time inside `zudoDocPreset()`), so the generated file is byte
20
+ * identical for every feature combination. The parameter is retained only
21
+ * for call-site compatibility (`scaffold.ts` passes `choices`). Do NOT add
22
+ * feature-gated branches here — wire new feature behaviour into
23
+ * `packages/zudo-doc/src/preset.ts` and the project's `settings.ts` instead.
18
24
  */
19
- export declare function generateZfbConfig(choices: UserChoices): string;
25
+ export declare function generateZfbConfig(_choices: UserChoices): string;