@graphql-markdown/formatters 1.0.1 → 1.1.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 (52) hide show
  1. package/dist/defaults.d.ts +27 -0
  2. package/dist/defaults.d.ts.map +1 -1
  3. package/dist/defaults.js +34 -1
  4. package/dist/docfx/index.d.ts +3 -7
  5. package/dist/docfx/index.d.ts.map +1 -1
  6. package/dist/docfx/index.js +109 -40
  7. package/dist/docusaurus/index.d.ts +16 -0
  8. package/dist/docusaurus/index.d.ts.map +1 -1
  9. package/dist/docusaurus/index.js +34 -3
  10. package/dist/fumadocs/index.d.ts +13 -3
  11. package/dist/fumadocs/index.d.ts.map +1 -1
  12. package/dist/fumadocs/index.js +19 -9
  13. package/dist/honkit/index.d.ts +3 -1
  14. package/dist/honkit/index.d.ts.map +1 -1
  15. package/dist/honkit/index.js +5 -2
  16. package/dist/hugo/index.d.ts +1 -1
  17. package/dist/hugo/index.d.ts.map +1 -1
  18. package/dist/hugo/index.js +6 -4
  19. package/dist/mdbook/index.d.ts +1 -1
  20. package/dist/mdbook/index.d.ts.map +1 -1
  21. package/dist/mdbook/index.js +7 -9
  22. package/dist/mkdocs/index.d.ts +3 -2
  23. package/dist/mkdocs/index.d.ts.map +1 -1
  24. package/dist/mkdocs/index.js +6 -7
  25. package/dist/output.d.ts +58 -0
  26. package/dist/output.d.ts.map +1 -0
  27. package/dist/output.js +112 -0
  28. package/dist/starlight/index.d.ts +13 -22
  29. package/dist/starlight/index.d.ts.map +1 -1
  30. package/dist/starlight/index.js +14 -34
  31. package/dist/version.d.ts +61 -0
  32. package/dist/version.d.ts.map +1 -0
  33. package/dist/version.js +119 -0
  34. package/dist/vocs/index.d.ts +18 -4
  35. package/dist/vocs/index.d.ts.map +1 -1
  36. package/dist/vocs/index.js +21 -9
  37. package/package.json +192 -192
  38. package/dist/docfx.d.ts +0 -20
  39. package/dist/docfx.d.ts.map +0 -1
  40. package/dist/docfx.js +0 -71
  41. package/dist/docusaurus.d.ts +0 -20
  42. package/dist/docusaurus.d.ts.map +0 -1
  43. package/dist/docusaurus.js +0 -72
  44. package/dist/hugo.d.ts +0 -20
  45. package/dist/hugo.d.ts.map +0 -1
  46. package/dist/hugo.js +0 -68
  47. package/dist/mdbook.d.ts +0 -20
  48. package/dist/mdbook.d.ts.map +0 -1
  49. package/dist/mdbook.js +0 -51
  50. package/dist/mkdocs.d.ts +0 -19
  51. package/dist/mkdocs.d.ts.map +0 -1
  52. package/dist/mkdocs.js +0 -65
@@ -9,11 +9,12 @@
9
9
  * @packageDocumentation
10
10
  */
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.beforeGenerateIndexMetafileHook = exports.mdxExtension = exports.createMDXFormatter = exports.formatMDXSpecifiedByLink = exports.formatMDXNameEntity = exports.formatMDXBullet = exports.formatMDXLink = exports.formatMDXFrontmatter = exports.formatMDXDetails = exports.formatMDXAdmonition = exports.formatMDXBadge = void 0;
12
+ exports.beforeGenerateIndexMetafileHook = exports.mdxExtension = exports.createMDXFormatter = exports.formatMDXSpecifiedByLink = exports.formatMDXPermalink = exports.formatMDXNameEntity = exports.formatMDXBullet = exports.formatMDXLink = exports.formatMDXFrontmatter = exports.formatMDXDetails = exports.formatMDXAdmonition = exports.formatMDXBadge = void 0;
13
13
  const node_path_1 = require("node:path");
14
14
  const helpers_1 = require("@graphql-markdown/helpers");
15
15
  const utils_1 = require("@graphql-markdown/utils");
16
16
  const defaults_1 = require("../defaults");
17
+ const output_1 = require("../output");
17
18
  /**
18
19
  * Maps graphql-markdown admonition types to Hugo GitHub-style alert types (Hugo 0.132+).
19
20
  * @see https://gohugo.io/render-hooks/blockquotes/#alerts
@@ -103,6 +104,7 @@ exports.formatMDXLink = formatMDXLink;
103
104
  var defaults_2 = require("../defaults");
104
105
  Object.defineProperty(exports, "formatMDXBullet", { enumerable: true, get: function () { return defaults_2.formatMDXBullet; } });
105
106
  Object.defineProperty(exports, "formatMDXNameEntity", { enumerable: true, get: function () { return defaults_2.formatMDXNameEntity; } });
107
+ Object.defineProperty(exports, "formatMDXPermalink", { enumerable: true, get: function () { return defaults_2.formatMDXPermalink; } });
106
108
  Object.defineProperty(exports, "formatMDXSpecifiedByLink", { enumerable: true, get: function () { return defaults_2.formatMDXSpecifiedByLink; } });
107
109
  /**
108
110
  * Creates a Hugo formatter.
@@ -118,6 +120,7 @@ const createMDXFormatter = (_meta) => {
118
120
  formatMDXFrontmatter: exports.formatMDXFrontmatter,
119
121
  formatMDXLink: exports.formatMDXLink,
120
122
  formatMDXNameEntity: defaults_1.formatMDXNameEntity,
123
+ formatMDXPermalink: defaults_1.formatMDXPermalink,
121
124
  formatMDXSpecifiedByLink: defaults_1.formatMDXSpecifiedByLink,
122
125
  };
123
126
  };
@@ -133,11 +136,10 @@ exports.mdxExtension = ".md";
133
136
  * @param event - Hook event whose `data` contains `dirPath` (target directory) and `category` (section name)
134
137
  */
135
138
  const beforeGenerateIndexMetafileHook = async (event) => {
136
- const { dirPath, category } = event.data;
139
+ const { dirPath, category, outputAdapter } = event.data;
137
140
  const filePath = (0, node_path_1.join)(dirPath, "_index.md");
138
141
  const label = (0, utils_1.startCase)(category);
139
142
  const content = `${utils_1.FRONT_MATTER_DELIMITER}${utils_1.MARKDOWN_EOL}title: "${label}"${utils_1.MARKDOWN_EOL}type: docs${utils_1.MARKDOWN_EOL}bookCollapseSection: true${utils_1.MARKDOWN_EOL}${utils_1.FRONT_MATTER_DELIMITER}${utils_1.MARKDOWN_EOL}${utils_1.MARKDOWN_EOL}# ${label}${utils_1.MARKDOWN_EOL}${utils_1.MARKDOWN_EOL}`;
140
- await (0, utils_1.ensureDir)(dirPath);
141
- await (0, utils_1.saveFile)(filePath, content);
143
+ await (0, output_1.writeOutput)(filePath, content, outputAdapter, dirPath);
142
144
  };
143
145
  exports.beforeGenerateIndexMetafileHook = beforeGenerateIndexMetafileHook;
@@ -51,7 +51,7 @@ export declare const mdxExtension = ".md";
51
51
  * @returns The link with `.md` appended to extensionless absolute paths
52
52
  */
53
53
  export declare const formatMDXLink: (link: TypeLink) => TypeLink;
54
- export { formatMDXBullet, formatMDXNameEntity, formatMDXSpecifiedByLink, } from "../defaults";
54
+ export { formatMDXBullet, formatMDXNameEntity, formatMDXPermalink, formatMDXSpecifiedByLink, } from "../defaults";
55
55
  /**
56
56
  * Rewrites absolute generated doc links to page-relative `.md` paths after each page is rendered.
57
57
  *
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/mdbook/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH,OAAO,KAAK,EACV,cAAc,EACd,KAAK,EACL,iBAAiB,EACjB,SAAS,EACT,kBAAkB,EAClB,KAAK,EACL,SAAS,EACT,QAAQ,EACR,eAAe,EACf,sBAAsB,EACtB,QAAQ,EACT,MAAM,yBAAyB,CAAC;AAoBjC;;;;GAIG;AACH,eAAO,MAAM,cAAc,aAAc,KAAK,KAAG,SAEhD,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB,0BACP,cAAc,SAC9B,KAAK,CAAC,QAAQ,CAAC,KACrB,SAIF,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,gBAAgB,kBAE1B,iBAAiB,KAAG,SAEtB,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB,WACvB,KAAK,CAAC,kBAAkB,CAAC,aACtB,KAAK,CAAC,MAAM,EAAE,CAAC,KACzB,SAGF,CAAC;AAEF,yEAAyE;AACzE,eAAO,MAAM,YAAY,QAAQ,CAAC;AAElC;;;;GAIG;AACH,eAAO,MAAM,aAAa,SAAU,QAAQ,KAAG,QAU9C,CAAC;AAEF,OAAO,EACL,eAAe,EACf,mBAAmB,EACnB,wBAAwB,GACzB,MAAM,aAAa,CAAC;AAyBrB;;;;;;;;;GASG;AACH,eAAO,MAAM,2BAA2B,EAAE,sBAoBzC,CAAC;AAEF;;;;GAIG;AACH,eAA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
@@ -10,11 +10,12 @@
10
10
  * @packageDocumentation
11
11
  */
12
12
  Object.defineProperty(exports, "__esModule", { value: true });
13
- exports.afterRenderFilesHook = exports.createMDXFormatter = exports.afterRenderTypeEntitiesHook = exports.formatMDXSpecifiedByLink = exports.formatMDXNameEntity = exports.formatMDXBullet = exports.formatMDXLink = exports.mdxExtension = exports.formatMDXFrontmatter = exports.formatMDXDetails = exports.formatMDXAdmonition = exports.formatMDXBadge = void 0;
13
+ exports.afterRenderFilesHook = exports.createMDXFormatter = exports.afterRenderTypeEntitiesHook = exports.formatMDXSpecifiedByLink = exports.formatMDXPermalink = exports.formatMDXNameEntity = exports.formatMDXBullet = exports.formatMDXLink = exports.mdxExtension = exports.formatMDXFrontmatter = exports.formatMDXDetails = exports.formatMDXAdmonition = exports.formatMDXBadge = void 0;
14
14
  const node_path_1 = require("node:path");
15
15
  const helpers_1 = require("@graphql-markdown/helpers");
16
16
  const utils_1 = require("@graphql-markdown/utils");
17
17
  const defaults_1 = require("../defaults");
18
+ const output_1 = require("../output");
18
19
  /**
19
20
  * Formats a badge as Markdown bold text — mdBook has no badge component.
20
21
  * @param badge - Badge data containing text
@@ -85,6 +86,7 @@ exports.formatMDXLink = formatMDXLink;
85
86
  var defaults_2 = require("../defaults");
86
87
  Object.defineProperty(exports, "formatMDXBullet", { enumerable: true, get: function () { return defaults_2.formatMDXBullet; } });
87
88
  Object.defineProperty(exports, "formatMDXNameEntity", { enumerable: true, get: function () { return defaults_2.formatMDXNameEntity; } });
89
+ Object.defineProperty(exports, "formatMDXPermalink", { enumerable: true, get: function () { return defaults_2.formatMDXPermalink; } });
88
90
  Object.defineProperty(exports, "formatMDXSpecifiedByLink", { enumerable: true, get: function () { return defaults_2.formatMDXSpecifiedByLink; } });
89
91
  const rewriteInternalLinks = (content, filePath, outputDir, baseURL) => {
90
92
  return content.replaceAll(/\]\((\/[^)\s#]+)(#[^)\s]+)?\)/g, (_match, urlPath, hash = "") => {
@@ -110,12 +112,7 @@ const rewriteInternalLinks = (content, filePath, outputDir, baseURL) => {
110
112
  * work correctly regardless of where the book is hosted.
111
113
  */
112
114
  const afterRenderTypeEntitiesHook = async (event) => {
113
- const { baseURL, filePath, outputDir } = event.data;
114
- const content = await (0, utils_1.readFile)(filePath, "utf-8");
115
- const rewrittenContent = rewriteInternalLinks(content, filePath, outputDir, baseURL);
116
- if (rewrittenContent !== content) {
117
- await (0, utils_1.saveFile)(filePath, rewrittenContent);
118
- }
115
+ await (0, output_1.rewriteRenderedPage)(event, rewriteInternalLinks);
119
116
  };
120
117
  exports.afterRenderTypeEntitiesHook = afterRenderTypeEntitiesHook;
121
118
  /**
@@ -132,6 +129,7 @@ const createMDXFormatter = (_meta) => {
132
129
  formatMDXFrontmatter: exports.formatMDXFrontmatter,
133
130
  formatMDXLink: exports.formatMDXLink,
134
131
  formatMDXNameEntity: defaults_1.formatMDXNameEntity,
132
+ formatMDXPermalink: defaults_1.formatMDXPermalink,
135
133
  formatMDXSpecifiedByLink: defaults_1.formatMDXSpecifiedByLink,
136
134
  };
137
135
  };
@@ -156,7 +154,7 @@ const SECTION_ORDER = [
156
154
  * by top-level section (Operations / Types) and category, then writes the file.
157
155
  */
158
156
  const afterRenderFilesHook = async (event) => {
159
- const { baseURL, outputDir, rootDir, pages } = event.data;
157
+ const { baseURL, outputDir, rootDir, pages, outputAdapter } = event.data;
160
158
  const summaryPath = (0, node_path_1.join)(rootDir, "SUMMARY.md");
161
159
  const allPages = pages
162
160
  .flat()
@@ -203,6 +201,6 @@ const afterRenderFilesHook = async (event) => {
203
201
  }
204
202
  lines.push("");
205
203
  }
206
- await (0, utils_1.saveFile)(summaryPath, lines.join("\n"));
204
+ await (0, output_1.writeOutput)(summaryPath, lines.join("\n"), outputAdapter);
207
205
  };
208
206
  exports.afterRenderFilesHook = afterRenderFilesHook;
@@ -7,10 +7,11 @@
7
7
  * @packageDocumentation
8
8
  */
9
9
  import type { AdmonitionType, Badge, CollapsibleOption, Formatter, FrontMatterOptions, Maybe, MDXString, MetaInfo, RenderTypeEntitiesHook } from "@graphql-markdown/types";
10
- import { formatMDXBullet, formatMDXLink } from "../defaults";
10
+ import { formatMDXBullet, formatMDXLink, formatMDXPermalink } from "../defaults";
11
11
  export declare const __default: {
12
12
  formatMDXBullet: typeof formatMDXBullet;
13
13
  formatMDXLink: typeof formatMDXLink;
14
+ formatMDXPermalink: typeof formatMDXPermalink;
14
15
  };
15
16
  /**
16
17
  * Formats a badge as an inline HTML mark element.
@@ -60,7 +61,7 @@ export declare const mdxExtension: ".md";
60
61
  * @param event - Hook payload containing the current file path and renderer output context
61
62
  */
62
63
  export declare const afterRenderTypeEntitiesHook: RenderTypeEntitiesHook;
63
- export { formatMDXBullet } from "../defaults";
64
+ export { formatMDXBullet, formatMDXPermalink } from "../defaults";
64
65
  /**
65
66
  * Creates an MkDocs Material formatter.
66
67
  * @param _meta - Unused metadata parameter
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/mkdocs/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EACV,cAAc,EACd,KAAK,EACL,iBAAiB,EACjB,SAAS,EACT,kBAAkB,EAClB,KAAK,EACL,SAAS,EACT,QAAQ,EACR,sBAAsB,EACvB,MAAM,yBAAyB,CAAC;AAYjC,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE7D,eAAO,MAAM,SAAS;;;CAGrB,CAAC;AAmCF;;;;GAIG;AACH,eAAO,MAAM,cAAc,aAAc,KAAK,KAAG,SAEhD,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB,0BACP,cAAc,SAC9B,KAAK,CAAC,QAAQ,CAAC,KACrB,SAIF,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,6BAG1B,iBAAiB,KAAG,SAEtB,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB,WACvB,KAAK,CAAC,kBA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,SAGF,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,SACxB,MAAM,eACC,KAAK,CAAC,MAAM,CAAC,KACzB,SAGF,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,wBAAwB,QAAS,MAAM,KAAG,SAEtD,CAAC;AAEF,2FAA2F;AAC3F,eAAO,MAAM,YAAY,EAAG,KAAc,CAAC;AAE3C;;;;GAIG;AACH,eAAO,MAAM,2BAA2B,EAAE,sBAIzC,CAAC;AAEF,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAElE;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,WAAY,KAAK,CAAC,QAAQ,CAAC,KAAG,SAY5D,CAAC"}
@@ -8,13 +8,15 @@
8
8
  * @packageDocumentation
9
9
  */
10
10
  Object.defineProperty(exports, "__esModule", { value: true });
11
- exports.createMDXFormatter = exports.formatMDXBullet = exports.afterRenderTypeEntitiesHook = exports.mdxExtension = exports.formatMDXSpecifiedByLink = exports.formatMDXNameEntity = exports.formatMDXFrontmatter = exports.formatMDXDetails = exports.formatMDXAdmonition = exports.formatMDXBadge = exports.__default = void 0;
11
+ exports.createMDXFormatter = exports.formatMDXPermalink = exports.formatMDXBullet = exports.afterRenderTypeEntitiesHook = exports.mdxExtension = exports.formatMDXSpecifiedByLink = exports.formatMDXNameEntity = exports.formatMDXFrontmatter = exports.formatMDXDetails = exports.formatMDXAdmonition = exports.formatMDXBadge = exports.__default = void 0;
12
12
  const helpers_1 = require("@graphql-markdown/helpers");
13
13
  const utils_1 = require("@graphql-markdown/utils");
14
14
  const defaults_1 = require("../defaults");
15
+ const output_1 = require("../output");
15
16
  exports.__default = {
16
17
  formatMDXBullet: defaults_1.formatMDXBullet,
17
18
  formatMDXLink: defaults_1.formatMDXLink,
19
+ formatMDXPermalink: defaults_1.formatMDXPermalink,
18
20
  };
19
21
  const ADMONITION_TYPE_MAP = {
20
22
  note: "note",
@@ -108,16 +110,12 @@ exports.mdxExtension = ".md";
108
110
  * @param event - Hook payload containing the current file path and renderer output context
109
111
  */
110
112
  const afterRenderTypeEntitiesHook = async (event) => {
111
- const { baseURL, filePath, outputDir } = event.data;
112
- const content = await (0, utils_1.readFile)(filePath, "utf-8");
113
- const rewrittenContent = rewriteInternalLinks(content, filePath, outputDir, baseURL);
114
- if (rewrittenContent !== content) {
115
- await (0, utils_1.saveFile)(filePath, rewrittenContent);
116
- }
113
+ await (0, output_1.rewriteRenderedPage)(event, rewriteInternalLinks);
117
114
  };
118
115
  exports.afterRenderTypeEntitiesHook = afterRenderTypeEntitiesHook;
119
116
  var defaults_2 = require("../defaults");
120
117
  Object.defineProperty(exports, "formatMDXBullet", { enumerable: true, get: function () { return defaults_2.formatMDXBullet; } });
118
+ Object.defineProperty(exports, "formatMDXPermalink", { enumerable: true, get: function () { return defaults_2.formatMDXPermalink; } });
121
119
  /**
122
120
  * Creates an MkDocs Material formatter.
123
121
  * @param _meta - Unused metadata parameter
@@ -132,6 +130,7 @@ const createMDXFormatter = (_meta) => {
132
130
  formatMDXFrontmatter: exports.formatMDXFrontmatter,
133
131
  formatMDXLink: defaults_1.formatMDXLink,
134
132
  formatMDXNameEntity: exports.formatMDXNameEntity,
133
+ formatMDXPermalink: defaults_1.formatMDXPermalink,
135
134
  formatMDXSpecifiedByLink: exports.formatMDXSpecifiedByLink,
136
135
  };
137
136
  };
@@ -0,0 +1,58 @@
1
+ /**
2
+ * Output helpers for formatter lifecycle hooks.
3
+ *
4
+ * Hooks post-process pages the renderer has already written, so they must go
5
+ * through the same destination the renderer used. Reaching for the filesystem
6
+ * directly works only as long as the default adapter is in play, and silently
7
+ * misses every page when the output is redirected elsewhere.
8
+ *
9
+ * @packageDocumentation
10
+ */
11
+ import type { Maybe, OutputAdapter } from "@graphql-markdown/types";
12
+ /**
13
+ * Reads back a page the renderer has written, through its output destination.
14
+ *
15
+ * The page was just written, so nothing coming back means the destination
16
+ * cannot be read - a write-only adapter, a stubbed `readFile`, or a store that
17
+ * is not read-your-writes consistent. Post-processing cannot run without it,
18
+ * which is reported rather than silently skipped.
19
+ *
20
+ * @param filePath - Path of the generated page
21
+ * @param outputAdapter - Adapter carried by the hook event, if any
22
+ * @returns The page content, or `undefined` if it cannot be read back
23
+ * @throws An error the first time this adapter cannot read a page back, so the
24
+ * skipped post-processing surfaces once instead of once per page.
25
+ */
26
+ export declare const readOutput: (filePath: string, outputAdapter: Maybe<OutputAdapter>) => Promise<string | undefined>;
27
+ /**
28
+ * Reads a file the formatter maintains itself, where absence is expected.
29
+ *
30
+ * Unlike {@link readOutput} this reports nothing when there is no content: a
31
+ * navigation or metadata file legitimately does not exist until the formatter
32
+ * creates it on the first page of a directory.
33
+ *
34
+ * @param filePath - Path of the file to read
35
+ * @param outputAdapter - Adapter carried by the hook event, if any
36
+ * @returns The file content, or `undefined` when there is none
37
+ */
38
+ export declare const readOptionalOutput: (filePath: string, outputAdapter: Maybe<OutputAdapter>) => Promise<string | undefined>;
39
+ /**
40
+ * Writes a file through the output destination, creating its directory first.
41
+ *
42
+ * @param filePath - Path of the file to write
43
+ * @param content - File content
44
+ * @param outputAdapter - Adapter carried by the hook event, if any
45
+ */
46
+ export declare const writeOutput: (filePath: string, content: string, outputAdapter: Maybe<OutputAdapter>, dirPath?: string) => Promise<void>;
47
+ /**
48
+ * Rewrites the content of a page a formatter has just rendered.
49
+ *
50
+ * The read-modify-write around an `afterRenderTypeEntities` hook is identical
51
+ * for every preset that post-processes its own output; only the rewriting
52
+ * differs. Presets supply that and nothing else.
53
+ *
54
+ * @param event - The hook event, carrying the page path and its destination
55
+ * @param rewrite - Returns the new content, or the content unchanged to skip
56
+ */
57
+ export declare const rewriteRenderedPage: (event: unknown, rewrite: (content: string, filePath: string, outputDir: string, baseURL: string) => string) => Promise<void>;
58
+ //# sourceMappingURL=output.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"output.d.ts","sourceRoot":"","sources":["../src/output.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AA0BpE;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,UAAU,aACX,MAAM,iBACD,KAAK,CAAC,aAAa,CAAC,KAClC,OAAO,CAAC,MAAM,GAAG,SAAS,CAgB5B,CAAC;AAEF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,kBAAkB,aACnB,MAAM,iBACD,KAAK,CAAC,aAAa,CAAC,KAClC,OAAO,CAAC,MAAM,GAAG,SAAS,CAE5B,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,WAAW,aACZ,MAAM,WACP,MAAM,iBACA,KAAK,CAAC,aAAa,CAAC,YACzB,MAAM,KACf,OAAO,CAAC,IAAI,CAQd,CAAC;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,mBAAmB,UACvB,OAAO,WACL,CACP,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,MAAM,KACZ,MAAM,KACV,OAAO,CAAC,IAAI,CAuBd,CAAC"}
package/dist/output.js ADDED
@@ -0,0 +1,112 @@
1
+ "use strict";
2
+ /**
3
+ * Output helpers for formatter lifecycle hooks.
4
+ *
5
+ * Hooks post-process pages the renderer has already written, so they must go
6
+ * through the same destination the renderer used. Reaching for the filesystem
7
+ * directly works only as long as the default adapter is in play, and silently
8
+ * misses every page when the output is redirected elsewhere.
9
+ *
10
+ * @packageDocumentation
11
+ */
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ exports.rewriteRenderedPage = exports.writeOutput = exports.readOptionalOutput = exports.readOutput = void 0;
14
+ const utils_1 = require("@graphql-markdown/utils");
15
+ /**
16
+ * Resolves the destination a hook must use, falling back to the filesystem.
17
+ *
18
+ * @param outputAdapter - Adapter carried by the hook event, if any
19
+ * @returns The adapter to read from and write to
20
+ */
21
+ const getOutputAdapter = (outputAdapter) => {
22
+ return outputAdapter ?? utils_1.fsOutputAdapter;
23
+ };
24
+ /**
25
+ * Adapters a failed read-back has already been reported for.
26
+ *
27
+ * A destination that cannot read back its own writes fails on every page, so
28
+ * reporting each one would bury the run in identical errors. Keyed by adapter
29
+ * rather than a flag, so one destination going quiet says nothing about
30
+ * another. An adapter instance reused across several runs in one process is
31
+ * therefore reported on its first failing run only.
32
+ */
33
+ const readBackReported = new WeakSet();
34
+ /**
35
+ * Reads back a page the renderer has written, through its output destination.
36
+ *
37
+ * The page was just written, so nothing coming back means the destination
38
+ * cannot be read - a write-only adapter, a stubbed `readFile`, or a store that
39
+ * is not read-your-writes consistent. Post-processing cannot run without it,
40
+ * which is reported rather than silently skipped.
41
+ *
42
+ * @param filePath - Path of the generated page
43
+ * @param outputAdapter - Adapter carried by the hook event, if any
44
+ * @returns The page content, or `undefined` if it cannot be read back
45
+ * @throws An error the first time this adapter cannot read a page back, so the
46
+ * skipped post-processing surfaces once instead of once per page.
47
+ */
48
+ const readOutput = async (filePath, outputAdapter) => {
49
+ const adapter = getOutputAdapter(outputAdapter);
50
+ const content = await adapter.readFile(filePath);
51
+ if (typeof content === "string") {
52
+ return content;
53
+ }
54
+ if (!readBackReported.has(adapter)) {
55
+ readBackReported.add(adapter);
56
+ throw new Error(`Cannot read back "${filePath}" from the output destination: the formatter cannot post-process what it wrote (e.g. internal link rewriting, navigation/metadata updates) for this run.`);
57
+ }
58
+ return undefined;
59
+ };
60
+ exports.readOutput = readOutput;
61
+ /**
62
+ * Reads a file the formatter maintains itself, where absence is expected.
63
+ *
64
+ * Unlike {@link readOutput} this reports nothing when there is no content: a
65
+ * navigation or metadata file legitimately does not exist until the formatter
66
+ * creates it on the first page of a directory.
67
+ *
68
+ * @param filePath - Path of the file to read
69
+ * @param outputAdapter - Adapter carried by the hook event, if any
70
+ * @returns The file content, or `undefined` when there is none
71
+ */
72
+ const readOptionalOutput = async (filePath, outputAdapter) => {
73
+ return getOutputAdapter(outputAdapter).readFile(filePath);
74
+ };
75
+ exports.readOptionalOutput = readOptionalOutput;
76
+ /**
77
+ * Writes a file through the output destination, creating its directory first.
78
+ *
79
+ * @param filePath - Path of the file to write
80
+ * @param content - File content
81
+ * @param outputAdapter - Adapter carried by the hook event, if any
82
+ */
83
+ const writeOutput = async (filePath, content, outputAdapter, dirPath) => {
84
+ const adapter = getOutputAdapter(outputAdapter);
85
+ if (typeof dirPath === "string") {
86
+ await adapter.ensureDir?.(dirPath);
87
+ }
88
+ await adapter.writeFile(filePath, content);
89
+ };
90
+ exports.writeOutput = writeOutput;
91
+ /**
92
+ * Rewrites the content of a page a formatter has just rendered.
93
+ *
94
+ * The read-modify-write around an `afterRenderTypeEntities` hook is identical
95
+ * for every preset that post-processes its own output; only the rewriting
96
+ * differs. Presets supply that and nothing else.
97
+ *
98
+ * @param event - The hook event, carrying the page path and its destination
99
+ * @param rewrite - Returns the new content, or the content unchanged to skip
100
+ */
101
+ const rewriteRenderedPage = async (event, rewrite) => {
102
+ const { baseURL, filePath, outputAdapter, outputDir } = event.data;
103
+ const content = await (0, exports.readOutput)(filePath, outputAdapter);
104
+ if (typeof content !== "string") {
105
+ return;
106
+ }
107
+ const rewritten = rewrite(content, filePath, outputDir, baseURL);
108
+ if (rewritten !== content) {
109
+ await (0, exports.writeOutput)(filePath, rewritten, outputAdapter);
110
+ }
111
+ };
112
+ exports.rewriteRenderedPage = rewriteRenderedPage;
@@ -8,6 +8,19 @@
8
8
  * @packageDocumentation
9
9
  */
10
10
  import type { AdmonitionType, Badge, Formatter, Maybe, MDXString, MetaInfo, TypeLink } from "@graphql-markdown/types";
11
+ import { formatMDXEscapedPermalink } from "../defaults";
12
+ /**
13
+ * Formats a permalink for a section header, using the classic `{#id}` syntax
14
+ * escaped to remain valid MDX.
15
+ *
16
+ * Starlight has no built-in custom header id syntax, so the permalink is inert
17
+ * unless a remark plugin such as `remark-custom-heading-id` is configured. Turn
18
+ * it off with `docOptions.sectionHeaderId: false`.
19
+ *
20
+ * @param id - The ID of the section header
21
+ * @returns Formatted permalink string
22
+ */
23
+ export declare const formatMDXPermalink: typeof formatMDXEscapedPermalink;
11
24
  /** File extension used for generated pages. */
12
25
  export declare const mdxExtension: ".mdx";
13
26
  /** MDX import statement prepended to every generated file to register Starlight components. */
@@ -35,28 +48,6 @@ export declare const formatMDXAdmonition: ({ text, title, type }: AdmonitionType
35
48
  */
36
49
  export declare const formatMDXLink: (link: TypeLink) => TypeLink;
37
50
  export { formatMDXBullet, formatMDXDetails, formatMDXFrontmatter, formatMDXNameEntity, formatMDXSpecifiedByLink, } from "../defaults";
38
- /**
39
- * Lifecycle hook that creates an `index.md` file for a category directory
40
- * before Starlight indexes it. Skips creation if the file already exists.
41
- * @param event - Hook payload containing the target directory and category name
42
- */
43
- export declare const beforeGenerateIndexMetafileHook: (event: {
44
- data: {
45
- dirPath: string;
46
- category: string;
47
- };
48
- }) => Promise<void>;
49
- /**
50
- * Lifecycle hook that appends a link entry to the category `index.md`
51
- * after each type entity page is rendered.
52
- * @param event - Hook payload containing the entity name and its output file path
53
- */
54
- export declare const afterRenderTypeEntitiesHook: (event: {
55
- data: {
56
- name: string;
57
- filePath: string;
58
- };
59
- }) => Promise<void>;
60
51
  /**
61
52
  * Creates an Astro Starlight formatter.
62
53
  * @param _meta - Unused metadata parameter
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/starlight/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAKH,OAAO,KAAK,EACV,cAAc,EACd,KAAK,EACL,SAAS,EACT,KAAK,EACL,SAAS,EACT,QAAQ,EACR,QAAQ,EACT,MAAM,yBAAyB,CAAC;AAgBjC,+CAA+C;AAC/C,eAAO,MAAM,YAAY,EAAG,MAAe,CAAC;AAE5C,+FAA+F;AAC/F,eAAO,MAAM,cAAc,EAAE,SAEf,CAAC;AAEf;;;;;GAKG;AACH,eAAO,MAAM,cAAc,wBAAyB,KAAK,KAAG,SAG3D,CAAC;AAEF;;;;;;GAM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G,SAG3D,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB,0BACP,cAAc,SAC9B,KAAK,CAAC,QAAQ,CAAC,KACrB,SAGF,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,aAAa,SAAU,QAAQ,KAAG,QAE9C,CAAC;AAEF,OAAO,EACL,eAAe,EACf,gBAAgB,EAChB,oBAAoB,EACpB,mBAAmB,EACnB,wBAAwB,GACzB,MAAM,aAAa,CAAC;AAErB;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,WAAY,KAAK,CAAC,QAAQ,CAAC,KAAG,SAY5D,CAAC"}
@@ -9,11 +9,21 @@
9
9
  * @packageDocumentation
10
10
  */
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.createMDXFormatter = exports.afterRenderTypeEntitiesHook = exports.beforeGenerateIndexMetafileHook = exports.formatMDXSpecifiedByLink = exports.formatMDXNameEntity = exports.formatMDXFrontmatter = exports.formatMDXDetails = exports.formatMDXBullet = exports.formatMDXLink = exports.formatMDXAdmonition = exports.formatMDXBadge = exports.mdxDeclaration = exports.mdxExtension = void 0;
13
- const node_path_1 = require("node:path");
14
- const promises_1 = require("node:fs/promises");
12
+ exports.createMDXFormatter = exports.formatMDXSpecifiedByLink = exports.formatMDXNameEntity = exports.formatMDXFrontmatter = exports.formatMDXDetails = exports.formatMDXBullet = exports.formatMDXLink = exports.formatMDXAdmonition = exports.formatMDXBadge = exports.mdxDeclaration = exports.mdxExtension = exports.formatMDXPermalink = void 0;
15
13
  const utils_1 = require("@graphql-markdown/utils");
16
14
  const defaults_1 = require("../defaults");
15
+ /**
16
+ * Formats a permalink for a section header, using the classic `{#id}` syntax
17
+ * escaped to remain valid MDX.
18
+ *
19
+ * Starlight has no built-in custom header id syntax, so the permalink is inert
20
+ * unless a remark plugin such as `remark-custom-heading-id` is configured. Turn
21
+ * it off with `docOptions.sectionHeaderId: false`.
22
+ *
23
+ * @param id - The ID of the section header
24
+ * @returns Formatted permalink string
25
+ */
26
+ exports.formatMDXPermalink = defaults_1.formatMDXEscapedPermalink;
17
27
  /** File extension used for generated pages. */
18
28
  exports.mdxExtension = ".mdx";
19
29
  /** MDX import statement prepended to every generated file to register Starlight components. */
@@ -59,37 +69,6 @@ Object.defineProperty(exports, "formatMDXDetails", { enumerable: true, get: func
59
69
  Object.defineProperty(exports, "formatMDXFrontmatter", { enumerable: true, get: function () { return defaults_2.formatMDXFrontmatter; } });
60
70
  Object.defineProperty(exports, "formatMDXNameEntity", { enumerable: true, get: function () { return defaults_2.formatMDXNameEntity; } });
61
71
  Object.defineProperty(exports, "formatMDXSpecifiedByLink", { enumerable: true, get: function () { return defaults_2.formatMDXSpecifiedByLink; } });
62
- const INDEX_MD = "index.md";
63
- /**
64
- * Lifecycle hook that creates an `index.md` file for a category directory
65
- * before Starlight indexes it. Skips creation if the file already exists.
66
- * @param event - Hook payload containing the target directory and category name
67
- */
68
- const beforeGenerateIndexMetafileHook = async (event) => {
69
- const { dirPath, category } = event.data;
70
- const filePath = (0, node_path_1.join)(dirPath, INDEX_MD);
71
- if (await (0, utils_1.fileExists)(filePath)) {
72
- return;
73
- }
74
- const label = (0, utils_1.startCase)(category);
75
- await (0, utils_1.ensureDir)(dirPath);
76
- await (0, utils_1.saveFile)(filePath, `---\ntitle: ${label}\n---\n`);
77
- };
78
- exports.beforeGenerateIndexMetafileHook = beforeGenerateIndexMetafileHook;
79
- /**
80
- * Lifecycle hook that appends a link entry to the category `index.md`
81
- * after each type entity page is rendered.
82
- * @param event - Hook payload containing the entity name and its output file path
83
- */
84
- const afterRenderTypeEntitiesHook = async (event) => {
85
- const { name, filePath } = event.data;
86
- const indexFilePath = (0, node_path_1.resolve)((0, node_path_1.dirname)(filePath), INDEX_MD);
87
- const pageFileName = (0, node_path_1.basename)(filePath);
88
- if (await (0, utils_1.fileExists)(indexFilePath)) {
89
- await (0, promises_1.appendFile)(indexFilePath, `- [${name}](./${pageFileName})\n`);
90
- }
91
- };
92
- exports.afterRenderTypeEntitiesHook = afterRenderTypeEntitiesHook;
93
72
  /**
94
73
  * Creates an Astro Starlight formatter.
95
74
  * @param _meta - Unused metadata parameter
@@ -104,6 +83,7 @@ const createMDXFormatter = (_meta) => {
104
83
  formatMDXFrontmatter: defaults_1.formatMDXFrontmatter,
105
84
  formatMDXLink: exports.formatMDXLink,
106
85
  formatMDXNameEntity: defaults_1.formatMDXNameEntity,
86
+ formatMDXPermalink: exports.formatMDXPermalink,
107
87
  formatMDXSpecifiedByLink: defaults_1.formatMDXSpecifiedByLink,
108
88
  };
109
89
  };
@@ -0,0 +1,61 @@
1
+ /**
2
+ * Helpers for gating formatter output on the target framework version.
3
+ *
4
+ * @packageDocumentation
5
+ */
6
+ import type { Maybe, MetaInfo } from "@graphql-markdown/types";
7
+ /** A framework version, narrowed down to the parts used for comparison. */
8
+ export interface FrameworkVersion {
9
+ major: number;
10
+ minor?: number;
11
+ }
12
+ /**
13
+ * Checks that the generator framework declared in `meta` is `framework`, and
14
+ * that its version matches `version`.
15
+ *
16
+ * Only the parts carried by `version` are compared, so `{ major: 2 }` matches
17
+ * any `2.x` release. An unknown, unparsable or mismatched framework version
18
+ * returns `false`.
19
+ *
20
+ * @param meta - Optional metadata carrying the framework name and version
21
+ * @param framework - The expected framework name, eg `"docusaurus"`
22
+ * @param version - The version to match
23
+ * @returns `true` if the framework and its version match
24
+ *
25
+ * @example
26
+ * ```js
27
+ * const meta = {
28
+ * generatorFrameworkName: "docusaurus",
29
+ * generatorFrameworkVersion: "2.4.3",
30
+ * };
31
+ *
32
+ * isFrameworkVersion(meta, "docusaurus", { major: 2 }); // true
33
+ * isFrameworkVersion(meta, "docusaurus", { major: 3 }); // false
34
+ * ```
35
+ */
36
+ export declare const isFrameworkVersion: (meta: Maybe<MetaInfo>, framework: string, version: FrameworkVersion) => boolean;
37
+ /**
38
+ * Checks that the generator framework declared in `meta` is `framework`, and
39
+ * that its version is `minVersion` or above.
40
+ *
41
+ * An unknown, unparsable or mismatched framework version returns `false`, so
42
+ * callers fall back to the output supported by every version.
43
+ *
44
+ * @param meta - Optional metadata carrying the framework name and version
45
+ * @param framework - The expected framework name, eg `"docusaurus"`
46
+ * @param minVersion - The minimum version required by the caller
47
+ * @returns `true` if the framework matches and its version is high enough
48
+ *
49
+ * @example
50
+ * ```js
51
+ * const meta = {
52
+ * generatorFrameworkName: "docusaurus",
53
+ * generatorFrameworkVersion: "3.10.2",
54
+ * };
55
+ *
56
+ * isFrameworkVersionAtLeast(meta, "docusaurus", { major: 3, minor: 10 }); // true
57
+ * isFrameworkVersionAtLeast(meta, "docusaurus", { major: 4 }); // false
58
+ * ```
59
+ */
60
+ export declare const isFrameworkVersionAtLeast: (meta: Maybe<MetaInfo>, framework: string, minVersion: FrameworkVersion) => boolean;
61
+ //# sourceMappingURL=version.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAE/D,2EAA2E;AAC3E,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAwED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,eAAO,MAAM,kBAAkB,SACvB,KAAK,CAAC,QAAQ,CAAC,aACV,MAAM,WACR,gBAAgB,KACxB,OAEF,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,yBAAyB,SAC9B,KAAK,CAAC,QAAQ,CAAC,aACV,MAAM,cACL,gBAAgB,KAC3B,OAIF,CAAC"}