@graphql-markdown/core 1.24.1 → 1.26.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/README.md +4 -3
- package/dist/config.d.ts +9 -6
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +37 -20
- package/dist/const/homepage.d.ts +6 -0
- package/dist/const/homepage.d.ts.map +1 -1
- package/dist/const/homepage.js +7 -1
- package/dist/const/patterns.d.ts.map +1 -1
- package/dist/diff.d.ts +2 -2
- package/dist/diff.d.ts.map +1 -1
- package/dist/diff.js +19 -3
- package/dist/event-emitter.d.ts.map +1 -1
- package/dist/event-handlers.js +5 -5
- package/dist/event-map.d.ts +8 -0
- package/dist/event-map.d.ts.map +1 -1
- package/dist/event-map.js +21 -30
- package/dist/events/index.d.ts +17 -17
- package/dist/events/index.d.ts.map +1 -1
- package/dist/events/index.js +34 -34
- package/dist/events/render-type-entities.d.ts +6 -0
- package/dist/events/render-type-entities.d.ts.map +1 -1
- package/dist/generator.d.ts.map +1 -1
- package/dist/generator.js +95 -52
- package/dist/graphql-config.d.ts.map +1 -1
- package/dist/graphql-config.js +22 -7
- package/dist/index.d.ts +18 -18
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +25 -25
- package/dist/optional-dependencies.d.ts +2 -0
- package/dist/optional-dependencies.d.ts.map +1 -0
- package/dist/optional-dependencies.js +9 -0
- package/dist/renderer.d.ts +13 -3
- package/dist/renderer.d.ts.map +1 -1
- package/dist/renderer.js +65 -36
- package/dist/telemetry.d.ts +53 -0
- package/dist/telemetry.d.ts.map +1 -0
- package/dist/telemetry.js +153 -0
- package/dist/version.d.ts +6 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +8 -0
- package/package.json +16 -14
|
@@ -13,18 +13,24 @@ import { DataEvent } from "@graphql-markdown/utils";
|
|
|
13
13
|
*/
|
|
14
14
|
export declare class RenderTypeEntitiesEvent extends DataEvent<{
|
|
15
15
|
baseURL: string;
|
|
16
|
+
/** Root for documentation links, as used when printing them. */
|
|
17
|
+
linkRoot?: string;
|
|
16
18
|
name: string;
|
|
17
19
|
filePath: string;
|
|
18
20
|
outputDir: string;
|
|
19
21
|
/** Destination the page was written to; use it to read the page back. */
|
|
20
22
|
outputAdapter?: OutputAdapter;
|
|
23
|
+
/** Root-level generated doc paths, known before concurrent pages are written. */
|
|
24
|
+
knownDocPaths?: ReadonlySet<string>;
|
|
21
25
|
}> {
|
|
22
26
|
constructor(data: {
|
|
23
27
|
baseURL: string;
|
|
28
|
+
linkRoot?: string;
|
|
24
29
|
name: string;
|
|
25
30
|
filePath: string;
|
|
26
31
|
outputDir: string;
|
|
27
32
|
outputAdapter?: OutputAdapter;
|
|
33
|
+
knownDocPaths?: ReadonlySet<string>;
|
|
28
34
|
}, options?: CancellableEventOptions);
|
|
29
35
|
}
|
|
30
36
|
//# sourceMappingURL=render-type-entities.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render-type-entities.d.ts","sourceRoot":"","sources":["../../src/events/render-type-entities.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AACvE,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAEpD;;;;GAIG;AACH,qBAAa,uBAAwB,SAAQ,SAAS,CAAC;IACrD,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,yEAAyE;IACzE,aAAa,CAAC,EAAE,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"render-type-entities.d.ts","sourceRoot":"","sources":["../../src/events/render-type-entities.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AACvE,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAEpD;;;;GAIG;AACH,qBAAa,uBAAwB,SAAQ,SAAS,CAAC;IACrD,OAAO,EAAE,MAAM,CAAC;IAChB,gEAAgE;IAChE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,yEAAyE;IACzE,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,iFAAiF;IACjF,aAAa,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;CACrC,CAAC;IACA,YACE,IAAI,EAAE;QACJ,OAAO,EAAE,MAAM,CAAC;QAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,IAAI,EAAE,MAAM,CAAC;QACb,QAAQ,EAAE,MAAM,CAAC;QACjB,SAAS,EAAE,MAAM,CAAC;QAClB,aAAa,CAAC,EAAE,aAAa,CAAC;QAC9B,aAAa,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;KACrC,EACD,OAAO,CAAC,EAAE,uBAAuB,EAGlC;CACF"}
|
package/dist/generator.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generator.d.ts","sourceRoot":"","sources":["../src/generator.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,KAAK,EAEV,aAAa,EACb,SAAS,EACT,gBAAgB,EAChB,gBAAgB,EAChB,aAAa,EACb,YAAY,EACZ,KAAK,EACL,QAAQ,EACR,WAAW,EAEX,cAAc,EAEf,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"generator.d.ts","sourceRoot":"","sources":["../src/generator.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,KAAK,EAEV,aAAa,EACb,SAAS,EACT,gBAAgB,EAChB,gBAAgB,EAChB,aAAa,EACb,YAAY,EACZ,KAAK,EACL,QAAQ,EACR,WAAW,EAEX,cAAc,EAEf,MAAM,yBAAyB,CAAC;AAkEjC;;;;;;;;;GASG;AACH,eAAO,MAAM,aAAa,cACb,KAAK,CAAC,WAAW,GAAG,MAAM,CAAC,KACrC,OAAO,CAAC,OAAO,CAgBjB,CAAC;AAiBF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,oBAAoB,GAAI,CAAC,aACzB,OAAO,gBACJ,MAAM,KACnB,CAAC,GAAG,SAmBN,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,yBAAyB,cACzB,OAAO,SACX,QAAQ,KACd,OAAO,CAAC,SAAS,CAAC,GAAG,SA+CvB,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,iBAAiB,mBACZ,MAAM,eACT,KAAK,CAAC,YAAY,CAAC,KAC/B,OAAO,CAAC,KAAK,CAAC,aAAa,CAAC,CAY9B,CAAC;AAEF;;;;;;;;;;;;;GAaG;AAEH,eAAO,MAAM,sBAAsB,WACzB,aAAa,kBACL,MAAM,cACV,KAAK,CAAC,cAAc,CAAC,UACzB,MAAM,KACb,OAAO,CAAC,OAAO,CAWjB,CAAC;AAEF;;;;;;;;;;;;GAYG;AAEH,eAAO,MAAM,4BAA4B,qBACrB,KAAK,CAAC,aAAa,GAAG,aAAa,EAAE,CAAC,oBACtC,KAAK,CAAC,aAAa,GAAG,aAAa,EAAE,CAAC,UAChD,aAAa,KACpB,gBAAgB,EAAE,EAsBpB,CAAC;AAmRF;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,qBAAqB,YACvB,gBAAgB,KACxB,OAAO,CAAC,IAAI,CAsBd,CAAC"}
|
package/dist/generator.js
CHANGED
|
@@ -32,6 +32,14 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
32
32
|
return result;
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
|
+
var __rewriteRelativeImportExtension = (this && this.__rewriteRelativeImportExtension) || function (path, preserveJsx) {
|
|
36
|
+
if (typeof path === "string" && /^\.\.?\//.test(path)) {
|
|
37
|
+
return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {
|
|
38
|
+
return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : (d + ext + "." + cm.toLowerCase() + "js");
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
return path;
|
|
42
|
+
};
|
|
35
43
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
44
|
exports.generateDocFromSchema = exports.resolveSkipAndOnlyDirectives = exports.checkSchemaDifferences = exports.loadGraphqlSchema = exports.getFormatterFromMDXModule = exports.getMDXModuleProperty = exports.loadMDXModule = void 0;
|
|
37
45
|
const logger_1 = __importStar(require("@graphql-markdown/logger"));
|
|
@@ -39,13 +47,14 @@ const graphql_1 = require("@graphql-markdown/graphql");
|
|
|
39
47
|
const printer_legacy_1 = require("@graphql-markdown/printer-legacy");
|
|
40
48
|
const utils_1 = require("@graphql-markdown/utils");
|
|
41
49
|
const node_path_1 = require("node:path");
|
|
42
|
-
const
|
|
43
|
-
const
|
|
44
|
-
const
|
|
45
|
-
const
|
|
46
|
-
const
|
|
47
|
-
const
|
|
48
|
-
const
|
|
50
|
+
const config_ts_1 = require("./config.js");
|
|
51
|
+
const diff_ts_1 = require("./diff.js");
|
|
52
|
+
const printer_ts_1 = require("./printer.js");
|
|
53
|
+
const renderer_ts_1 = require("./renderer.js");
|
|
54
|
+
const event_emitter_ts_1 = require("./event-emitter.js");
|
|
55
|
+
const index_ts_1 = require("./events/index.js");
|
|
56
|
+
const event_handlers_ts_1 = require("./event-handlers.js");
|
|
57
|
+
const telemetry_ts_1 = require("./telemetry.js");
|
|
49
58
|
/**
|
|
50
59
|
* Supported file extensions for generated documentation files.
|
|
51
60
|
*
|
|
@@ -81,13 +90,18 @@ const SEC_DECIMALS = 3;
|
|
|
81
90
|
* @internal
|
|
82
91
|
*/
|
|
83
92
|
const loadMDXModule = async (mdxParser) => {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
93
|
+
if (mdxParser === undefined || mdxParser === null) {
|
|
94
|
+
return undefined;
|
|
95
|
+
}
|
|
96
|
+
// Specifier is only known at runtime (user-configured formatter package).
|
|
97
|
+
// Resolved into a variable first: tsgo's CJS emit of `import(fn(x))` with
|
|
98
|
+
// rewriteRelativeImportExtensions leaves `fn` unqualified (ReferenceError).
|
|
99
|
+
const specifier = (0, utils_1.runtimeModuleSpecifier)(mdxParser);
|
|
100
|
+
return import(__rewriteRelativeImportExtension(specifier)).catch((error) => {
|
|
101
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
102
|
+
(0, logger_1.log)(`An error occurred while loading MDX formatter "${mdxParser}": ${errorMessage}`, logger_1.LogLevel.warn);
|
|
103
|
+
return undefined;
|
|
104
|
+
});
|
|
91
105
|
};
|
|
92
106
|
exports.loadMDXModule = loadMDXModule;
|
|
93
107
|
/**
|
|
@@ -219,8 +233,8 @@ exports.loadGraphqlSchema = loadGraphqlSchema;
|
|
|
219
233
|
// Used only by unit tests for direct whitebox coverage; not part of the production public API.
|
|
220
234
|
const checkSchemaDifferences = async (schema, schemaLocation, diffMethod, tmpDir) => {
|
|
221
235
|
let changed = true;
|
|
222
|
-
if (diffMethod !==
|
|
223
|
-
changed = await (0,
|
|
236
|
+
if (diffMethod !== config_ts_1.DiffMethod.NONE) {
|
|
237
|
+
changed = await (0, diff_ts_1.hasChanges)(schema, tmpDir, diffMethod);
|
|
224
238
|
if (!changed) {
|
|
225
239
|
(0, logger_1.log)(`No changes detected in schema "${(0, utils_1.toString)(schemaLocation)}".`);
|
|
226
240
|
}
|
|
@@ -265,54 +279,42 @@ const resolveSkipAndOnlyDirectives = (onlyDocDirective, skipDocDirective, schema
|
|
|
265
279
|
});
|
|
266
280
|
};
|
|
267
281
|
exports.resolveSkipAndOnlyDirectives = resolveSkipAndOnlyDirectives;
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
*
|
|
271
|
-
* This function coordinates the entire documentation generation process:
|
|
272
|
-
* - Loads and validates the schema
|
|
273
|
-
* - Checks for schema changes if diffing is enabled
|
|
274
|
-
* - Processes directives and groups
|
|
275
|
-
* - Initializes printers and renderers
|
|
276
|
-
* - Generates markdown files
|
|
277
|
-
*
|
|
278
|
-
* @param options - Complete configuration for the documentation generation
|
|
279
|
-
* @returns Promise that resolves when documentation is fully generated
|
|
280
|
-
*/
|
|
281
|
-
const generateDocFromSchema = async (options) => {
|
|
282
|
-
const start = process.hrtime.bigint();
|
|
282
|
+
// fallow-ignore-next-line complexity
|
|
283
|
+
const runGeneration = async (options, start, outcome) => {
|
|
283
284
|
await (0, logger_1.default)(options.loggerModule);
|
|
284
285
|
const mdxModule = await (0, exports.loadMDXModule)(options.formatter);
|
|
285
286
|
// Register MDX lifecycle event handlers if mdxModule loaded successfully
|
|
286
287
|
// This must be called BEFORE getEvents() because it resets the singleton
|
|
287
|
-
(0,
|
|
288
|
+
(0, event_handlers_ts_1.registerMDXEventHandlers)(mdxModule);
|
|
288
289
|
// Get events AFTER registration (registerMDXEventHandlers resets and recreates the singleton)
|
|
289
|
-
const events = (0,
|
|
290
|
+
const events = (0, event_emitter_ts_1.getEvents)();
|
|
290
291
|
// Emitted before destructuring `options` below, so a hook that mutates
|
|
291
292
|
// `event.data.config` (same object reference as `options`) is picked up.
|
|
292
|
-
await events.emitAsync(
|
|
293
|
+
await events.emitAsync(index_ts_1.ConfigBuildEvents.AFTER_BUILD, new index_ts_1.ConfigBuildEvent({ config: options }));
|
|
293
294
|
const { baseURL, customDirective, decorators, diffMethod, docOptions, force, groupByDirective, homepageLocation, linkRoot, loaders: loadersList, metatags, onlyDocDirective, outputAdapter, outputDir, prettify, printTypeOptions, schemaLocation, skipDocDirective, tmpDir, } = options;
|
|
294
|
-
await events.emitAsync(
|
|
295
|
+
await events.emitAsync(index_ts_1.SchemaEvents.BEFORE_LOAD, new index_ts_1.SchemaEvent({
|
|
295
296
|
schemaLocation: schemaLocation,
|
|
296
297
|
}));
|
|
297
298
|
const schema = await (0, exports.loadGraphqlSchema)(schemaLocation, loadersList);
|
|
298
|
-
await events.emitAsync(
|
|
299
|
+
await events.emitAsync(index_ts_1.SchemaEvents.AFTER_LOAD, new index_ts_1.SchemaEvent({
|
|
299
300
|
schemaLocation: schemaLocation,
|
|
300
301
|
schema,
|
|
301
302
|
}));
|
|
302
303
|
if (!schema) {
|
|
303
304
|
(0, logger_1.log)(`Failed to load GraphQL schema from location "${(0, utils_1.toString)(schemaLocation)}".`, "error");
|
|
305
|
+
outcome.noSchema = true;
|
|
304
306
|
return;
|
|
305
307
|
}
|
|
306
|
-
await events.emitAsync(
|
|
308
|
+
await events.emitAsync(index_ts_1.DiffEvents.BEFORE_CHECK, new index_ts_1.DiffCheckEvent({
|
|
307
309
|
schema,
|
|
308
310
|
outputDir: tmpDir,
|
|
309
311
|
}));
|
|
310
312
|
const schemaHasChanges = await (0, exports.checkSchemaDifferences)(schema, schemaLocation, diffMethod, tmpDir);
|
|
311
|
-
await events.emitAsync(
|
|
313
|
+
await events.emitAsync(index_ts_1.DiffEvents.AFTER_CHECK, new index_ts_1.DiffCheckEvent({ schemaHasChanges }));
|
|
312
314
|
const [onlyDocDirectives, skipDocDirectives] = (0, exports.resolveSkipAndOnlyDirectives)(onlyDocDirective, skipDocDirective, schema);
|
|
313
|
-
events.emit(
|
|
315
|
+
events.emit(index_ts_1.SchemaEvents.BEFORE_MAP, new index_ts_1.SchemaEvent({ schema }));
|
|
314
316
|
const rootTypes = (0, graphql_1.getSchemaMap)(schema);
|
|
315
|
-
events.emit(
|
|
317
|
+
events.emit(index_ts_1.SchemaEvents.AFTER_MAP, new index_ts_1.SchemaEvent({ schema, rootTypes }));
|
|
316
318
|
// `customDirective` is schema-resolved here, then immediately converted
|
|
317
319
|
// into decorators and merged into `decorators` itself: the printer never
|
|
318
320
|
// sees `customDirective` or the resolved `CustomDirectiveMap` it produces,
|
|
@@ -326,7 +328,7 @@ const generateDocFromSchema = async (options) => {
|
|
|
326
328
|
const mdxFormatter = (0, exports.getFormatterFromMDXModule)(mdxModule, docOptions);
|
|
327
329
|
// Extract mdxDeclaration from the MDX module (if available)
|
|
328
330
|
const mdxDeclaration = (0, exports.getMDXModuleProperty)(mdxModule, "mdxDeclaration");
|
|
329
|
-
const printer = await (0,
|
|
331
|
+
const printer = await (0, printer_ts_1.getPrinter)(
|
|
330
332
|
// config mandatory
|
|
331
333
|
{
|
|
332
334
|
baseURL,
|
|
@@ -361,10 +363,11 @@ const generateDocFromSchema = async (options) => {
|
|
|
361
363
|
else {
|
|
362
364
|
mdxExtension = FILE_EXTENSION.MD;
|
|
363
365
|
}
|
|
364
|
-
const renderer = await (0,
|
|
366
|
+
const renderer = await (0, renderer_ts_1.getRenderer)({
|
|
365
367
|
printer,
|
|
366
368
|
outputDir,
|
|
367
369
|
baseURL,
|
|
370
|
+
linkRoot,
|
|
368
371
|
group: groups,
|
|
369
372
|
prettify,
|
|
370
373
|
docOptions: {
|
|
@@ -378,28 +381,30 @@ const generateDocFromSchema = async (options) => {
|
|
|
378
381
|
});
|
|
379
382
|
// Pre-collect all categories before rendering to ensure consistent positions
|
|
380
383
|
renderer.preCollectCategories(Object.keys(rootTypes));
|
|
381
|
-
|
|
384
|
+
renderer.preCollectGeneratedDocPaths(rootTypes);
|
|
385
|
+
const beforeRenderRootTypesEvent = new index_ts_1.RenderRootTypesEvent({
|
|
382
386
|
rootTypes,
|
|
383
387
|
});
|
|
384
|
-
await events.emitAsync(
|
|
388
|
+
await events.emitAsync(index_ts_1.RenderRootTypesEvents.BEFORE_RENDER, beforeRenderRootTypesEvent);
|
|
385
389
|
const pages = await Promise.all(Object.keys(rootTypes).map(async (name) => {
|
|
386
390
|
const typeName = name;
|
|
387
391
|
return renderer.renderRootTypes(typeName, rootTypes[typeName]);
|
|
388
392
|
}));
|
|
389
|
-
|
|
393
|
+
outcome.pages = pages.flat().length;
|
|
394
|
+
const afterRenderRootTypesEvent = new index_ts_1.RenderRootTypesEvent({
|
|
390
395
|
rootTypes,
|
|
391
396
|
});
|
|
392
|
-
await events.emitAsync(
|
|
393
|
-
const beforeRenderHomepageEvent = new
|
|
397
|
+
await events.emitAsync(index_ts_1.RenderRootTypesEvents.AFTER_RENDER, afterRenderRootTypesEvent);
|
|
398
|
+
const beforeRenderHomepageEvent = new index_ts_1.RenderHomepageEvent({
|
|
394
399
|
outputDir,
|
|
395
400
|
});
|
|
396
|
-
await events.emitAsync(
|
|
401
|
+
await events.emitAsync(index_ts_1.RenderHomepageEvents.BEFORE_RENDER, beforeRenderHomepageEvent);
|
|
397
402
|
await renderer.renderHomepage(homepageLocation);
|
|
398
|
-
const afterRenderHomepageEvent = new
|
|
403
|
+
const afterRenderHomepageEvent = new index_ts_1.RenderHomepageEvent({
|
|
399
404
|
outputDir,
|
|
400
405
|
});
|
|
401
|
-
await events.emitAsync(
|
|
402
|
-
const { errors: renderFilesErrors } = await events.emitAsync(
|
|
406
|
+
await events.emitAsync(index_ts_1.RenderHomepageEvents.AFTER_RENDER, afterRenderHomepageEvent);
|
|
407
|
+
const { errors: renderFilesErrors } = await events.emitAsync(index_ts_1.RenderFilesEvents.AFTER_RENDER, new index_ts_1.RenderFilesEvent({
|
|
403
408
|
baseURL,
|
|
404
409
|
outputDir,
|
|
405
410
|
rootDir: (0, node_path_1.dirname)(outputDir),
|
|
@@ -409,7 +414,8 @@ const generateDocFromSchema = async (options) => {
|
|
|
409
414
|
}));
|
|
410
415
|
// without this a failure to write mdBook's SUMMARY.md is dropped, and the
|
|
411
416
|
// success line below claims the documentation is complete
|
|
412
|
-
(0,
|
|
417
|
+
(0, renderer_ts_1.logHandlerErrors)(index_ts_1.RenderFilesEvents.AFTER_RENDER, renderFilesErrors);
|
|
418
|
+
outcome.postError = renderFilesErrors[0];
|
|
413
419
|
const duration = (Number(process.hrtime.bigint() - start) / NS_PER_SEC).toFixed(SEC_DECIMALS);
|
|
414
420
|
// a formatter that could not finish its output must not be reported as a
|
|
415
421
|
// success: mdBook cannot build without the SUMMARY.md written by that hook
|
|
@@ -421,4 +427,41 @@ const generateDocFromSchema = async (options) => {
|
|
|
421
427
|
}
|
|
422
428
|
(0, logger_1.log)(`${pages.flat().length} pages generated in ${duration}s from schema "${(0, utils_1.toString)(schemaLocation)}".`);
|
|
423
429
|
};
|
|
430
|
+
/**
|
|
431
|
+
* Main entry point for generating Markdown documentation from a GraphQL schema.
|
|
432
|
+
*
|
|
433
|
+
* This function coordinates the entire documentation generation process:
|
|
434
|
+
* - Loads and validates the schema
|
|
435
|
+
* - Checks for schema changes if diffing is enabled
|
|
436
|
+
* - Processes directives and groups
|
|
437
|
+
* - Initializes printers and renderers
|
|
438
|
+
* - Generates markdown files
|
|
439
|
+
*
|
|
440
|
+
* @param options - Complete configuration for the documentation generation
|
|
441
|
+
* @returns Promise that resolves when documentation is fully generated
|
|
442
|
+
*/
|
|
443
|
+
const generateDocFromSchema = async (options) => {
|
|
444
|
+
const start = process.hrtime.bigint();
|
|
445
|
+
const outcome = { pages: 0, noSchema: false };
|
|
446
|
+
let failed = false;
|
|
447
|
+
let thrown;
|
|
448
|
+
try {
|
|
449
|
+
await runGeneration(options, start, outcome);
|
|
450
|
+
}
|
|
451
|
+
catch (error) {
|
|
452
|
+
failed = true;
|
|
453
|
+
thrown = error;
|
|
454
|
+
throw error;
|
|
455
|
+
}
|
|
456
|
+
finally {
|
|
457
|
+
void (0, telemetry_ts_1.reportGeneration)({
|
|
458
|
+
telemetry: options.telemetryContext,
|
|
459
|
+
pages: outcome.pages,
|
|
460
|
+
durationMs: Number(process.hrtime.bigint() - start) / 1e6,
|
|
461
|
+
error: failed ? (thrown ?? new Error("unknown")) : undefined,
|
|
462
|
+
noSchema: outcome.noSchema,
|
|
463
|
+
postError: outcome.postError,
|
|
464
|
+
});
|
|
465
|
+
}
|
|
466
|
+
};
|
|
424
467
|
exports.generateDocFromSchema = generateDocFromSchema;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graphql-config.d.ts","sourceRoot":"","sources":["../src/graphql-config.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,KAAK,EAEV,sBAAsB,EACtB,2BAA2B,EAC3B,YAAY,EACZ,KAAK,EAEL,oBAAoB,EACrB,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"graphql-config.d.ts","sourceRoot":"","sources":["../src/graphql-config.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,KAAK,EAEV,sBAAsB,EACtB,2BAA2B,EAC3B,YAAY,EACZ,KAAK,EAEL,oBAAoB,EACrB,MAAM,yBAAyB,CAAC;AAgCjC;;;;;;;;;;;;GAYG;AAEH,eAAO,MAAM,sBAAsB,EAAE,2BAEpC,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,WAAW,YAAY;IAC3B,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAWD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,eAAO,MAAM,gBAAgB,YAClB,YAAY,WACZ,oBAAoB,KAC5B,YAeF,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,eAAO,MAAM,iBAAiB,OACxB,KAAK,CAAC,MAAM,CAAC,YACP,KAAK,CAAC,oBAAoB,CAAC,qCACH,YAAY,KAC7C,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,sBAAsB,CAAC,CAAC,CAwDjD,CAAC"}
|
package/dist/graphql-config.js
CHANGED
|
@@ -1,8 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __rewriteRelativeImportExtension = (this && this.__rewriteRelativeImportExtension) || function (path, preserveJsx) {
|
|
3
|
+
if (typeof path === "string" && /^\.\.?\//.test(path)) {
|
|
4
|
+
return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {
|
|
5
|
+
return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : (d + ext + "." + cm.toLowerCase() + "js");
|
|
6
|
+
});
|
|
7
|
+
}
|
|
8
|
+
return path;
|
|
9
|
+
};
|
|
2
10
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
11
|
exports.loadConfiguration = exports.setLoaderOptions = exports.graphQLConfigExtension = void 0;
|
|
4
12
|
const logger_1 = require("@graphql-markdown/logger");
|
|
5
|
-
const
|
|
13
|
+
const utils_1 = require("@graphql-markdown/utils");
|
|
14
|
+
const optional_dependencies_ts_1 = require("./optional-dependencies.js");
|
|
15
|
+
const validation_ts_1 = require("./directives/validation.js");
|
|
16
|
+
// Kept out of static analysis so JSR does not turn the optional peer into a hard dependency.
|
|
17
|
+
const GRAPHQL_CONFIG_MODULE = "graphql-config";
|
|
6
18
|
/**
|
|
7
19
|
* The name of the GraphQL Markdown extension.
|
|
8
20
|
* Used to identify the extension in graphql-config.
|
|
@@ -60,7 +72,7 @@ const DEFAULT_THROW_OPTIONS = {
|
|
|
60
72
|
// Used only by unit tests for direct whitebox coverage; not part of the production public API.
|
|
61
73
|
const setLoaderOptions = (loaders, options) => {
|
|
62
74
|
for (const loader in loaders) {
|
|
63
|
-
if ((0,
|
|
75
|
+
if ((0, validation_ts_1.isLoaderString)(loaders[loader])) {
|
|
64
76
|
loaders[loader] = {
|
|
65
77
|
module: loaders[loader],
|
|
66
78
|
options,
|
|
@@ -110,10 +122,13 @@ const loadConfiguration = async (id, options, { throwOnMissing, throwOnEmpty } =
|
|
|
110
122
|
return undefined;
|
|
111
123
|
}
|
|
112
124
|
try {
|
|
113
|
-
|
|
125
|
+
// Resolved into a variable first: tsgo's CJS emit of `import(fn(x))` with
|
|
126
|
+
// rewriteRelativeImportExtensions leaves `fn` unqualified (ReferenceError).
|
|
127
|
+
const specifier = (0, utils_1.runtimeModuleSpecifier)(GRAPHQL_CONFIG_MODULE, optional_dependencies_ts_1.OPTIONAL_DEPENDENCY_RANGES[GRAPHQL_CONFIG_MODULE]);
|
|
128
|
+
graphQLConfig = (await import(__rewriteRelativeImportExtension(specifier)));
|
|
114
129
|
}
|
|
115
|
-
catch {
|
|
116
|
-
(0, logger_1.log)(
|
|
130
|
+
catch (error) {
|
|
131
|
+
(0, logger_1.log)(`Cannot load module 'graphql-config': ${error.message}`);
|
|
117
132
|
return undefined;
|
|
118
133
|
}
|
|
119
134
|
const config = await graphQLConfig.loadConfig({
|
|
@@ -131,10 +146,10 @@ const loadConfiguration = async (id, options, { throwOnMissing, throwOnEmpty } =
|
|
|
131
146
|
.extension(EXTENSION_NAME);
|
|
132
147
|
if (Array.isArray(projectConfig.schema)) {
|
|
133
148
|
const schema = projectConfig.schema[0];
|
|
134
|
-
if ((0,
|
|
149
|
+
if ((0, validation_ts_1.isSchemaString)(schema)) {
|
|
135
150
|
projectConfig.schema = schema;
|
|
136
151
|
}
|
|
137
|
-
else if ((0,
|
|
152
|
+
else if ((0, validation_ts_1.isSchemaObject)(schema)) {
|
|
138
153
|
projectConfig.schema = Object.keys(schema)[0];
|
|
139
154
|
if (projectConfig.loaders) {
|
|
140
155
|
projectConfig.loaders = (0, exports.setLoaderOptions)(projectConfig.loaders, Object.values(schema)[0]);
|
package/dist/index.d.ts
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @primaryExport
|
|
3
3
|
*/
|
|
4
|
-
export { generateDocFromSchema } from "./generator";
|
|
5
|
-
export { buildConfig } from "./config";
|
|
6
|
-
export { getEvents, resetEvents, type CancellableEventEmitter, type EmitResult, } from "./event-emitter";
|
|
7
|
-
export { registerMDXEventHandlers } from "./event-handlers";
|
|
8
|
-
export { EVENT_CALLBACK_MAP } from "./event-map";
|
|
9
|
-
export { SchemaEvents } from "./events/schema-events";
|
|
10
|
-
export { DiffEvents } from "./events/diff-events";
|
|
11
|
-
export { RenderRootTypesEvents } from "./events/render-root-types-events";
|
|
12
|
-
export { RenderHomepageEvents } from "./events/render-homepage-events";
|
|
13
|
-
export { RenderTypeEntitiesEvents } from "./events/render-type-entities-events";
|
|
14
|
-
export { GenerateIndexMetafileEvents } from "./events/generate-index-metafile-events";
|
|
15
|
-
export { PrintTypeEvents } from "./events/print-type-events";
|
|
16
|
-
export type { SchemaEvent as SchemaLoadEvent } from "./events/schema-load";
|
|
17
|
-
export type { DiffCheckEvent } from "./events/diff-check";
|
|
18
|
-
export type { RenderRootTypesEvent } from "./events/render-root-types";
|
|
19
|
-
export type { RenderHomepageEvent } from "./events/render-homepage";
|
|
20
|
-
export type { RenderTypeEntitiesEvent } from "./events/render-type-entities";
|
|
21
|
-
export type { GenerateIndexMetafileEvent } from "./events/generate-index-metafile";
|
|
4
|
+
export { generateDocFromSchema } from "./generator.ts";
|
|
5
|
+
export { buildConfig } from "./config.ts";
|
|
6
|
+
export { getEvents, resetEvents, type CancellableEventEmitter, type EmitResult, } from "./event-emitter.ts";
|
|
7
|
+
export { registerMDXEventHandlers } from "./event-handlers.ts";
|
|
8
|
+
export { EVENT_CALLBACK_MAP } from "./event-map.ts";
|
|
9
|
+
export { SchemaEvents } from "./events/schema-events.ts";
|
|
10
|
+
export { DiffEvents } from "./events/diff-events.ts";
|
|
11
|
+
export { RenderRootTypesEvents } from "./events/render-root-types-events.ts";
|
|
12
|
+
export { RenderHomepageEvents } from "./events/render-homepage-events.ts";
|
|
13
|
+
export { RenderTypeEntitiesEvents } from "./events/render-type-entities-events.ts";
|
|
14
|
+
export { GenerateIndexMetafileEvents } from "./events/generate-index-metafile-events.ts";
|
|
15
|
+
export { PrintTypeEvents } from "./events/print-type-events.ts";
|
|
16
|
+
export type { SchemaEvent as SchemaLoadEvent } from "./events/schema-load.ts";
|
|
17
|
+
export type { DiffCheckEvent } from "./events/diff-check.ts";
|
|
18
|
+
export type { RenderRootTypesEvent } from "./events/render-root-types.ts";
|
|
19
|
+
export type { RenderHomepageEvent } from "./events/render-homepage.ts";
|
|
20
|
+
export type { RenderTypeEntitiesEvent } from "./events/render-type-entities.ts";
|
|
21
|
+
export type { GenerateIndexMetafileEvent } from "./events/generate-index-metafile.ts";
|
|
22
22
|
export type { ComposePageTypeEventData, IPrintCodeEvent, IPrintTypeEvent, PageSection, PageSections, PrintCodeEventData, PrintTypeEventData, } from "@graphql-markdown/types";
|
|
23
23
|
export { CancellableEvent } from "@graphql-markdown/utils";
|
|
24
24
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,qBAAqB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAG1C,OAAO,EACL,SAAS,EACT,WAAW,EACX,KAAK,uBAAuB,EAC5B,KAAK,UAAU,GAChB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AAC/D,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAGpD,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,qBAAqB,EAAE,MAAM,sCAAsC,CAAC;AAC7E,OAAO,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAC1E,OAAO,EAAE,wBAAwB,EAAE,MAAM,yCAAyC,CAAC;AACnF,OAAO,EAAE,2BAA2B,EAAE,MAAM,4CAA4C,CAAC;AACzF,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAGhE,YAAY,EAAE,WAAW,IAAI,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC9E,YAAY,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAC7D,YAAY,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AAC1E,YAAY,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AACvE,YAAY,EAAE,uBAAuB,EAAE,MAAM,kCAAkC,CAAC;AAChF,YAAY,EAAE,0BAA0B,EAAE,MAAM,qCAAqC,CAAC;AACtF,YAAY,EACV,wBAAwB,EACxB,eAAe,EACf,eAAe,EACf,WAAW,EACX,YAAY,EACZ,kBAAkB,EAClB,kBAAkB,GACnB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -4,32 +4,32 @@
|
|
|
4
4
|
*/
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.CancellableEvent = exports.PrintTypeEvents = exports.GenerateIndexMetafileEvents = exports.RenderTypeEntitiesEvents = exports.RenderHomepageEvents = exports.RenderRootTypesEvents = exports.DiffEvents = exports.SchemaEvents = exports.EVENT_CALLBACK_MAP = exports.registerMDXEventHandlers = exports.resetEvents = exports.getEvents = exports.buildConfig = exports.generateDocFromSchema = void 0;
|
|
7
|
-
var
|
|
8
|
-
Object.defineProperty(exports, "generateDocFromSchema", { enumerable: true, get: function () { return
|
|
9
|
-
var
|
|
10
|
-
Object.defineProperty(exports, "buildConfig", { enumerable: true, get: function () { return
|
|
7
|
+
var generator_ts_1 = require("./generator.js");
|
|
8
|
+
Object.defineProperty(exports, "generateDocFromSchema", { enumerable: true, get: function () { return generator_ts_1.generateDocFromSchema; } });
|
|
9
|
+
var config_ts_1 = require("./config.js");
|
|
10
|
+
Object.defineProperty(exports, "buildConfig", { enumerable: true, get: function () { return config_ts_1.buildConfig; } });
|
|
11
11
|
// Event system exports
|
|
12
|
-
var
|
|
13
|
-
Object.defineProperty(exports, "getEvents", { enumerable: true, get: function () { return
|
|
14
|
-
Object.defineProperty(exports, "resetEvents", { enumerable: true, get: function () { return
|
|
15
|
-
var
|
|
16
|
-
Object.defineProperty(exports, "registerMDXEventHandlers", { enumerable: true, get: function () { return
|
|
17
|
-
var
|
|
18
|
-
Object.defineProperty(exports, "EVENT_CALLBACK_MAP", { enumerable: true, get: function () { return
|
|
12
|
+
var event_emitter_ts_1 = require("./event-emitter.js");
|
|
13
|
+
Object.defineProperty(exports, "getEvents", { enumerable: true, get: function () { return event_emitter_ts_1.getEvents; } });
|
|
14
|
+
Object.defineProperty(exports, "resetEvents", { enumerable: true, get: function () { return event_emitter_ts_1.resetEvents; } });
|
|
15
|
+
var event_handlers_ts_1 = require("./event-handlers.js");
|
|
16
|
+
Object.defineProperty(exports, "registerMDXEventHandlers", { enumerable: true, get: function () { return event_handlers_ts_1.registerMDXEventHandlers; } });
|
|
17
|
+
var event_map_ts_1 = require("./event-map.js");
|
|
18
|
+
Object.defineProperty(exports, "EVENT_CALLBACK_MAP", { enumerable: true, get: function () { return event_map_ts_1.EVENT_CALLBACK_MAP; } });
|
|
19
19
|
// Event constant exports
|
|
20
|
-
var
|
|
21
|
-
Object.defineProperty(exports, "SchemaEvents", { enumerable: true, get: function () { return
|
|
22
|
-
var
|
|
23
|
-
Object.defineProperty(exports, "DiffEvents", { enumerable: true, get: function () { return
|
|
24
|
-
var
|
|
25
|
-
Object.defineProperty(exports, "RenderRootTypesEvents", { enumerable: true, get: function () { return
|
|
26
|
-
var
|
|
27
|
-
Object.defineProperty(exports, "RenderHomepageEvents", { enumerable: true, get: function () { return
|
|
28
|
-
var
|
|
29
|
-
Object.defineProperty(exports, "RenderTypeEntitiesEvents", { enumerable: true, get: function () { return
|
|
30
|
-
var
|
|
31
|
-
Object.defineProperty(exports, "GenerateIndexMetafileEvents", { enumerable: true, get: function () { return
|
|
32
|
-
var
|
|
33
|
-
Object.defineProperty(exports, "PrintTypeEvents", { enumerable: true, get: function () { return
|
|
20
|
+
var schema_events_ts_1 = require("./events/schema-events.js");
|
|
21
|
+
Object.defineProperty(exports, "SchemaEvents", { enumerable: true, get: function () { return schema_events_ts_1.SchemaEvents; } });
|
|
22
|
+
var diff_events_ts_1 = require("./events/diff-events.js");
|
|
23
|
+
Object.defineProperty(exports, "DiffEvents", { enumerable: true, get: function () { return diff_events_ts_1.DiffEvents; } });
|
|
24
|
+
var render_root_types_events_ts_1 = require("./events/render-root-types-events.js");
|
|
25
|
+
Object.defineProperty(exports, "RenderRootTypesEvents", { enumerable: true, get: function () { return render_root_types_events_ts_1.RenderRootTypesEvents; } });
|
|
26
|
+
var render_homepage_events_ts_1 = require("./events/render-homepage-events.js");
|
|
27
|
+
Object.defineProperty(exports, "RenderHomepageEvents", { enumerable: true, get: function () { return render_homepage_events_ts_1.RenderHomepageEvents; } });
|
|
28
|
+
var render_type_entities_events_ts_1 = require("./events/render-type-entities-events.js");
|
|
29
|
+
Object.defineProperty(exports, "RenderTypeEntitiesEvents", { enumerable: true, get: function () { return render_type_entities_events_ts_1.RenderTypeEntitiesEvents; } });
|
|
30
|
+
var generate_index_metafile_events_ts_1 = require("./events/generate-index-metafile-events.js");
|
|
31
|
+
Object.defineProperty(exports, "GenerateIndexMetafileEvents", { enumerable: true, get: function () { return generate_index_metafile_events_ts_1.GenerateIndexMetafileEvents; } });
|
|
32
|
+
var print_type_events_ts_1 = require("./events/print-type-events.js");
|
|
33
|
+
Object.defineProperty(exports, "PrintTypeEvents", { enumerable: true, get: function () { return print_type_events_ts_1.PrintTypeEvents; } });
|
|
34
34
|
var utils_1 = require("@graphql-markdown/utils");
|
|
35
35
|
Object.defineProperty(exports, "CancellableEvent", { enumerable: true, get: function () { return utils_1.CancellableEvent; } });
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"optional-dependencies.d.ts","sourceRoot":"","sources":["../src/optional-dependencies.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,0BAA0B,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAGvE,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Deno version ranges of the optional dependencies, generated from package.json
|
|
3
|
+
// by `bun run jsr:sync` (verified by `bun run jsr:check`). Do not edit by hand.
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.OPTIONAL_DEPENDENCY_RANGES = void 0;
|
|
6
|
+
exports.OPTIONAL_DEPENDENCY_RANGES = {
|
|
7
|
+
"@graphql-markdown/diff": "^1.1.23",
|
|
8
|
+
"graphql-config": "^6.0.0",
|
|
9
|
+
};
|
package/dist/renderer.d.ts
CHANGED
|
@@ -83,6 +83,8 @@ export interface RendererOptions {
|
|
|
83
83
|
outputDir: string;
|
|
84
84
|
/** Base URL for the documentation */
|
|
85
85
|
baseURL: string;
|
|
86
|
+
/** Root for documentation links, forwarded to render hooks */
|
|
87
|
+
linkRoot?: string;
|
|
86
88
|
/** Optional grouping configuration for schema entities */
|
|
87
89
|
group: Maybe<SchemaEntitiesGroupMap>;
|
|
88
90
|
/** Whether to format the generated markdown */
|
|
@@ -109,6 +111,7 @@ export declare class Renderer {
|
|
|
109
111
|
readonly group: Maybe<SchemaEntitiesGroupMap>;
|
|
110
112
|
readonly outputDir: string;
|
|
111
113
|
readonly baseURL: string;
|
|
114
|
+
readonly linkRoot?: string;
|
|
112
115
|
readonly prettify: boolean;
|
|
113
116
|
readonly options: Maybe<RendererDocOptions>;
|
|
114
117
|
readonly mdxExtension: string;
|
|
@@ -116,13 +119,14 @@ export declare class Renderer {
|
|
|
116
119
|
private readonly printer;
|
|
117
120
|
private readonly rootLevelPositionManager;
|
|
118
121
|
private readonly categoryPositionManager;
|
|
122
|
+
private readonly knownDocPaths;
|
|
119
123
|
/**
|
|
120
124
|
* Creates a new Renderer instance.
|
|
121
125
|
*
|
|
122
126
|
* @param options - Renderer construction options
|
|
123
127
|
* @example
|
|
124
128
|
*/
|
|
125
|
-
constructor({ printer, outputDir, baseURL, group, prettify, docOptions, mdxExtension, outputAdapter, }: RendererOptions);
|
|
129
|
+
constructor({ printer, outputDir, baseURL, linkRoot, group, prettify, docOptions, mdxExtension, outputAdapter, }: RendererOptions);
|
|
126
130
|
/**
|
|
127
131
|
* Generates an index metafile for a category directory if MDX support is available.
|
|
128
132
|
*
|
|
@@ -172,6 +176,12 @@ export declare class Renderer {
|
|
|
172
176
|
* @example
|
|
173
177
|
*/
|
|
174
178
|
renderTypeEntities(dirPath: string, name: string, type: unknown, operationNamespaceParts?: string[], entity?: SchemaEntity): Promise<Maybe<Category>>;
|
|
179
|
+
/**
|
|
180
|
+
* Pre-collects root-level generated document paths for flat hierarchy.
|
|
181
|
+
*
|
|
182
|
+
* @param rootTypes - Map of schema entity names to their generated types
|
|
183
|
+
*/
|
|
184
|
+
preCollectGeneratedDocPaths(rootTypes: object): void;
|
|
175
185
|
/**
|
|
176
186
|
* Pre-collects all category names that will be generated during rendering.
|
|
177
187
|
* This allows the position manager to assign consistent positions before
|
|
@@ -199,7 +209,7 @@ export declare class Renderer {
|
|
|
199
209
|
* @returns Promise that resolves when the homepage is rendered
|
|
200
210
|
* @example
|
|
201
211
|
*/
|
|
202
|
-
renderHomepage(homepageLocation: Maybe<string>): Promise<void>;
|
|
212
|
+
renderHomepage(homepageLocation: Maybe<string | symbol>): Promise<void>;
|
|
203
213
|
/**
|
|
204
214
|
* Registers custom group names from the current group configuration.
|
|
205
215
|
* Custom groups are always registered at the ROOT level.
|
|
@@ -277,5 +287,5 @@ export declare class Renderer {
|
|
|
277
287
|
* });
|
|
278
288
|
* ```
|
|
279
289
|
*/
|
|
280
|
-
export declare const getRenderer: ({ printer, outputDir, baseURL, group, prettify, docOptions, mdxExtension, outputAdapter, }: RendererOptions) => Promise<InstanceType<typeof Renderer>>;
|
|
290
|
+
export declare const getRenderer: ({ printer, outputDir, baseURL, linkRoot, group, prettify, docOptions, mdxExtension, outputAdapter, }: RendererOptions) => Promise<InstanceType<typeof Renderer>>;
|
|
281
291
|
//# sourceMappingURL=renderer.d.ts.map
|
package/dist/renderer.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderer.d.ts","sourceRoot":"","sources":["../src/renderer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,oBAAoB,EACpB,QAAQ,EAER,KAAK,EAEL,QAAQ,EACR,aAAa,EACb,kBAAkB,EAClB,sBAAsB,EACtB,YAAY,EAGb,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"renderer.d.ts","sourceRoot":"","sources":["../src/renderer.ts"],"names":[],"mappings":"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"}
|