@takazudo/zudo-doc 9.1.3 → 9.1.5

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/CHANGELOG.md CHANGED
@@ -8,6 +8,16 @@ The format is based on Keep a Changelog, and release notes are generated from th
8
8
 
9
9
  No unreleased changes.
10
10
 
11
+ ## [9.1.5] - 2026-11-08
12
+
13
+ ### Bug Fixes
14
+
15
+ - When `docHistory` is enabled, the routes plugin now supplies the doc-history manifest (`.zfb/doc-history-meta.json`) as the default `docHistoryMeta` chrome binding, so the body-foot view-source link and the Created/Updated block render in projects that do not pass `hostBindings.docHistoryMeta` themselves. A missing manifest falls back to `{}`, host bindings still take precedence, and output with `docHistory` off is unchanged. (8df74e68)
16
+
17
+ ## [9.1.4] - 2026-11-06
18
+
19
+ - No package-specific changes.
20
+
11
21
  ## [9.1.3] - 2026-11-06
12
22
 
13
23
  ### Bug Fixes
@@ -37,6 +37,7 @@ export interface DocMetainfoAreaProps {
37
37
  *
38
38
  * Reads `settings`/`defaultLocale`/`t` directly and `toHistorySlug` from the
39
39
  * package slug helper; the per-page git-history manifest is a HOST-bound slot
40
- * (`ctx.hostBindings.docHistoryMeta`, default `{}` → no Created/Updated block).
40
+ * (`ctx.hostBindings.docHistoryMeta`; the routes plugin supplies the build-time
41
+ * manifest by default when docHistory is on, otherwise `{}` → no block).
41
42
  */
42
43
  export declare function createDocMetainfoArea<S extends Settings = Settings>(ctx: ChromeContext<S>): (props: DocMetainfoAreaProps) => Child;
@@ -45,5 +45,19 @@ interface RouteSpec {
45
45
  * directly — a build-driven test cannot construct it.
46
46
  */
47
47
  export declare function shouldWarnDtpFullyShadowed(routes: ReadonlyArray<Pick<RouteSpec, "pattern" | "includedInDtpShadowDiagnostic">>, isShadowed: (pattern: string) => boolean): boolean;
48
+ /**
49
+ * Ensure `<projectRoot>/.zfb/doc-history-meta.json` exists so a static import
50
+ * of it always resolves, writing a `{}` seed only when the file is missing.
51
+ * The doc-history plugin's preBuild overwrites it with real data before
52
+ * bundling. Returns the absolute, forward-slash-normalized manifest path.
53
+ */
54
+ export declare function ensureDocHistoryMetaSeed(projectRoot: string): string;
55
+ /**
56
+ * ESM source for `virtual:zudo-doc-chrome-bindings`. With docHistory off the
57
+ * output is byte-identical to the pre-#4708 shapes. With docHistory on, the
58
+ * build-time manifest becomes a default `docHistoryMeta` that the host
59
+ * bindings (spread last) can override.
60
+ */
61
+ export declare function buildChromeBindingsModuleSource(hostModuleAbsPath: string | undefined, docHistoryMetaAbsPath: string | null): string;
48
62
  declare const plugin: import("@takazudo/zfb").ZfbPlugin;
49
63
  export default plugin;
@@ -1,6 +1,6 @@
1
1
  import { prepareHomeIntros } from "../home-intro/prepare.js";
2
2
  import { createRequire } from "node:module";
3
- import { existsSync, statSync, readFileSync, cpSync, mkdirSync, rmSync } from "node:fs";
3
+ import { existsSync, statSync, readFileSync, cpSync, mkdirSync, rmSync, writeFileSync } from "node:fs";
4
4
  import { dirname, basename, join } from "node:path";
5
5
  import { definePlugin } from "@takazudo/zfb/plugins";
6
6
  import { loadThemePackRegistry } from "../theme-packs-registry/load-registry.js";
@@ -132,6 +132,30 @@ function assetContentRoots(projectRoot, options, settings) {
132
132
  }
133
133
  return roots;
134
134
  }
135
+ function ensureDocHistoryMetaSeed(projectRoot) {
136
+ const metaPath = join(projectRoot, ".zfb", "doc-history-meta.json");
137
+ if (!existsSync(metaPath)) {
138
+ mkdirSync(dirname(metaPath), { recursive: true });
139
+ writeFileSync(metaPath, "{}\n");
140
+ }
141
+ return metaPath.split("\\").join("/");
142
+ }
143
+ function buildChromeBindingsModuleSource(hostModuleAbsPath, docHistoryMetaAbsPath) {
144
+ if (!docHistoryMetaAbsPath) {
145
+ return hostModuleAbsPath ? `export { chromeBindings } from ${JSON.stringify(hostModuleAbsPath)};
146
+ ` : `export const chromeBindings = {};
147
+ `;
148
+ }
149
+ const metaImport = `import docHistoryMeta from ${JSON.stringify(docHistoryMetaAbsPath)};
150
+ `;
151
+ if (!hostModuleAbsPath) {
152
+ return `${metaImport}export const chromeBindings = { docHistoryMeta };
153
+ `;
154
+ }
155
+ return metaImport + `import { chromeBindings as hostChromeBindings } from ${JSON.stringify(hostModuleAbsPath)};
156
+ export const chromeBindings = { docHistoryMeta, ...hostChromeBindings };
157
+ `;
158
+ }
135
159
  function resolveHostModuleOverride(projectRoot, settingName, settingValue, hints) {
136
160
  if (typeof settingValue === "string" && settingValue.trim() === "") {
137
161
  throw new Error(
@@ -271,11 +295,10 @@ const plugin = definePlugin({
271
295
  mustExport: "chromeBindings: ChromeHostBindings"
272
296
  }
273
297
  );
298
+ const docHistoryMetaAbsPath = settings.docHistory ? ensureDocHistoryMetaSeed(ctx.projectRoot) : null;
274
299
  ctx.addVirtualModule(
275
300
  "virtual:zudo-doc-chrome-bindings",
276
- () => chromeBindingsAbsPath ? `export { chromeBindings } from ${JSON.stringify(chromeBindingsAbsPath)};
277
- ` : `export const chromeBindings = {};
278
- `
301
+ () => buildChromeBindingsModuleSource(chromeBindingsAbsPath, docHistoryMetaAbsPath)
279
302
  );
280
303
  const designTokenPanelConfigAbsPath = resolveHostModuleOverride(
281
304
  ctx.projectRoot,
@@ -367,6 +390,8 @@ const plugin = definePlugin({
367
390
  });
368
391
  var routes_default = plugin;
369
392
  export {
393
+ buildChromeBindingsModuleSource,
370
394
  routes_default as default,
395
+ ensureDocHistoryMetaSeed,
371
396
  shouldWarnDtpFullyShadowed
372
397
  };
@@ -522,7 +522,10 @@ export interface Settings {
522
522
  * `ChromeHostBindings` (from `@takazudo/zudo-doc/factory-context`).
523
523
  *
524
524
  * - Absent (the default) → the virtual module emits
525
- * `export const chromeBindings = {};` — behavior byte-identical to today.
525
+ * `export const chromeBindings = {};` — behavior byte-identical to today —
526
+ * except with `docHistory` on, where it emits
527
+ * `{ docHistoryMeta }` from a static import of `.zfb/doc-history-meta.json`
528
+ * (#4708). A host module's own bindings are spread after that default.
526
529
  * - Explicitly empty string → build fails loudly at plugin setup.
527
530
  * - Present but the resolved file does not exist → the build fails loudly
528
531
  * at plugin setup, naming the resolved absolute path (never a silent
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@takazudo/zudo-doc",
3
- "version": "9.1.3",
3
+ "version": "9.1.5",
4
4
  "type": "module",
5
5
  "description": "zudo-doc framework primitives layer that sits on top of zfb's engine — sidebar, theme, TOC, breadcrumb, layouts, head injection, View Transitions, SSR-skip wrappers (per ADR-003).",
6
6
  "license": "MIT",
@@ -809,7 +809,7 @@
809
809
  "typescript": "^5.0.0",
810
810
  "vitest": "^4.1.12",
811
811
  "zod": "^4.6.7",
812
- "@takazudo/zudo-doc-history-server": "9.1.3"
812
+ "@takazudo/zudo-doc-history-server": "9.1.5"
813
813
  },
814
814
  "scripts": {
815
815
  "gen:search-widget-script": "node scripts/gen-search-widget-script.mjs",