@graphql-markdown/core 1.18.1 → 1.20.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/assets/generated.md +1 -8
- package/dist/config.d.ts +8 -6
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +39 -8
- package/dist/const/patterns.d.ts +9 -9
- package/dist/const/patterns.js +9 -9
- package/dist/diff.d.ts +5 -0
- package/dist/diff.d.ts.map +1 -1
- package/dist/diff.js +1 -34
- package/dist/directives/normalize.d.ts.map +1 -1
- package/dist/directives/normalize.js +3 -1
- package/dist/event-emitter.d.ts +7 -2
- package/dist/event-emitter.d.ts.map +1 -1
- package/dist/event-emitter.js +32 -23
- package/dist/event-map.d.ts +1 -0
- package/dist/event-map.d.ts.map +1 -1
- package/dist/event-map.js +1 -0
- package/dist/events/diff-check.d.ts +7 -8
- package/dist/events/diff-check.d.ts.map +1 -1
- package/dist/events/diff-check.js +3 -6
- package/dist/events/generate-index-metafile.d.ts +7 -8
- package/dist/events/generate-index-metafile.d.ts.map +1 -1
- package/dist/events/generate-index-metafile.js +3 -6
- package/dist/events/index.d.ts +1 -3
- package/dist/events/index.d.ts.map +1 -1
- package/dist/events/index.js +1 -8
- package/dist/events/print-type-events.d.ts +5 -2
- package/dist/events/print-type-events.d.ts.map +1 -1
- package/dist/events/print-type-events.js +5 -2
- package/dist/events/print-type.d.ts +4 -78
- package/dist/events/print-type.d.ts.map +1 -1
- package/dist/events/print-type.js +3 -66
- package/dist/events/render-homepage.d.ts +5 -6
- package/dist/events/render-homepage.d.ts.map +1 -1
- package/dist/events/render-homepage.js +3 -6
- package/dist/events/render-root-types.d.ts +5 -6
- package/dist/events/render-root-types.d.ts.map +1 -1
- package/dist/events/render-root-types.js +3 -6
- package/dist/events/render-type-entities.d.ts +6 -7
- package/dist/events/render-type-entities.d.ts.map +1 -1
- package/dist/events/render-type-entities.js +3 -6
- package/dist/events/schema-load.d.ts +7 -8
- package/dist/events/schema-load.d.ts.map +1 -1
- package/dist/events/schema-load.js +3 -6
- package/dist/generator.d.ts.map +1 -1
- package/dist/generator.js +2 -1
- package/dist/graphql-config.js +1 -34
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/options/builder.d.ts +13 -13
- package/dist/options/builder.d.ts.map +1 -1
- package/dist/options/builder.js +25 -25
- package/dist/printer.d.ts +5 -0
- package/dist/printer.d.ts.map +1 -1
- package/dist/printer.js +1 -34
- package/dist/renderer.d.ts +1 -1
- package/dist/renderer.d.ts.map +1 -1
- package/dist/renderer.js +45 -11
- package/package.json +26 -17
- package/dist/events/base.d.ts +0 -119
- package/dist/events/base.d.ts.map +0 -1
- package/dist/events/base.js +0 -149
|
@@ -14,10 +14,11 @@ exports.PrintTypeEvents = void 0;
|
|
|
14
14
|
*
|
|
15
15
|
* @example
|
|
16
16
|
* ```typescript
|
|
17
|
-
* import { getEvents, PrintTypeEvents
|
|
17
|
+
* import { getEvents, PrintTypeEvents } from "@graphql-markdown/core";
|
|
18
|
+
* import { PrintCodeEvent } from "@graphql-markdown/printer-legacy";
|
|
18
19
|
*
|
|
19
20
|
* const events = getEvents();
|
|
20
|
-
* events.on(PrintTypeEvents.AFTER_PRINT_CODE, (event:
|
|
21
|
+
* events.on(PrintTypeEvents.AFTER_PRINT_CODE, (event: PrintCodeEvent) => {
|
|
21
22
|
* // Modify the generated code
|
|
22
23
|
* event.output = event.output.toUpperCase();
|
|
23
24
|
* });
|
|
@@ -32,4 +33,6 @@ exports.PrintTypeEvents = {
|
|
|
32
33
|
BEFORE_PRINT_TYPE: "print:beforePrintType",
|
|
33
34
|
/** Emitted after generating the full type documentation (output can be modified) */
|
|
34
35
|
AFTER_PRINT_TYPE: "print:afterPrintType",
|
|
36
|
+
/** Emitted before composing page sections (can modify section content) */
|
|
37
|
+
BEFORE_COMPOSE_PAGE_TYPE: "print:beforeComposePageType",
|
|
35
38
|
};
|
|
@@ -1,84 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Print type
|
|
2
|
+
* Print type interfaces — re-exported from \@graphql-markdown/types.
|
|
3
3
|
*
|
|
4
|
-
* Event
|
|
4
|
+
* Event class implementations (PrintCodeEvent, PrintTypeEvent, etc.) live in
|
|
5
|
+
* \@graphql-markdown/printer-legacy, which is the package that emits the events.
|
|
5
6
|
*
|
|
6
7
|
* @packageDocumentation
|
|
7
8
|
*/
|
|
8
|
-
|
|
9
|
-
import { CancellableEvent, CancellableEventOptions } from "./base";
|
|
10
|
-
/**
|
|
11
|
-
* Data payload for print code events.
|
|
12
|
-
*/
|
|
13
|
-
export interface PrintCodeEventData {
|
|
14
|
-
/** The GraphQL type being printed */
|
|
15
|
-
readonly type: unknown;
|
|
16
|
-
/** The name of the type */
|
|
17
|
-
readonly typeName: string;
|
|
18
|
-
/** The print options in effect */
|
|
19
|
-
readonly options: PrintTypeOptions;
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Event emitted before/after generating the code block for a GraphQL type.
|
|
23
|
-
*
|
|
24
|
-
* The `output` property is mutable, allowing event handlers to modify
|
|
25
|
-
* the generated code before it's included in the documentation.
|
|
26
|
-
*
|
|
27
|
-
* @example
|
|
28
|
-
* ```typescript
|
|
29
|
-
* events.on(PrintTypeEvents.AFTER_PRINT_CODE, (event: PrintCodeEvent) => {
|
|
30
|
-
* // Add a comment to all generated code
|
|
31
|
-
* event.output = `# Auto-generated\n${event.output}`;
|
|
32
|
-
* });
|
|
33
|
-
* ```
|
|
34
|
-
*
|
|
35
|
-
* @category Events
|
|
36
|
-
*/
|
|
37
|
-
export declare class PrintCodeEvent extends CancellableEvent {
|
|
38
|
-
/** Read-only event data */
|
|
39
|
-
readonly data: PrintCodeEventData;
|
|
40
|
-
/**
|
|
41
|
-
* The generated code output.
|
|
42
|
-
* Handlers can modify this property to change the final output.
|
|
43
|
-
*/
|
|
44
|
-
output: string;
|
|
45
|
-
constructor(data: PrintCodeEventData, initialOutput: string, options?: CancellableEventOptions);
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* Data payload for print type events.
|
|
49
|
-
*/
|
|
50
|
-
export interface PrintTypeEventData {
|
|
51
|
-
/** The GraphQL type being printed */
|
|
52
|
-
readonly type: unknown;
|
|
53
|
-
/** The name identifier for the type */
|
|
54
|
-
readonly name: Maybe<string>;
|
|
55
|
-
/** The print options in effect */
|
|
56
|
-
readonly options: PrintTypeOptions;
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* Event emitted before/after generating the full documentation for a GraphQL type.
|
|
60
|
-
*
|
|
61
|
-
* The `output` property is mutable, allowing event handlers to modify
|
|
62
|
-
* the complete generated documentation.
|
|
63
|
-
*
|
|
64
|
-
* @example
|
|
65
|
-
* ```typescript
|
|
66
|
-
* events.on(PrintTypeEvents.AFTER_PRINT_TYPE, (event: PrintTypeEvent) => {
|
|
67
|
-
* // Add a footer to all type documentation
|
|
68
|
-
* event.output = `${event.output}\n\n---\nGenerated by GraphQL-Markdown`;
|
|
69
|
-
* });
|
|
70
|
-
* ```
|
|
71
|
-
*
|
|
72
|
-
* @category Events
|
|
73
|
-
*/
|
|
74
|
-
export declare class PrintTypeEvent extends CancellableEvent {
|
|
75
|
-
/** Read-only event data */
|
|
76
|
-
readonly data: PrintTypeEventData;
|
|
77
|
-
/**
|
|
78
|
-
* The generated documentation output.
|
|
79
|
-
* Handlers can modify this property to change the final output.
|
|
80
|
-
*/
|
|
81
|
-
output: Maybe<MDXString>;
|
|
82
|
-
constructor(data: PrintTypeEventData, initialOutput: Maybe<MDXString>, options?: CancellableEventOptions);
|
|
83
|
-
}
|
|
9
|
+
export type { PageSection, PageSections, PrintCodeEventData, PrintTypeEventData, ComposePageTypeEventData, } from "@graphql-markdown/types";
|
|
84
10
|
//# sourceMappingURL=print-type.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"print-type.d.ts","sourceRoot":"","sources":["../../src/events/print-type.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"print-type.d.ts","sourceRoot":"","sources":["../../src/events/print-type.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,YAAY,EACV,WAAW,EACX,YAAY,EACZ,kBAAkB,EAClB,kBAAkB,EAClB,wBAAwB,GACzB,MAAM,yBAAyB,CAAC"}
|
|
@@ -1,73 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/**
|
|
3
|
-
* Print type
|
|
3
|
+
* Print type interfaces — re-exported from \@graphql-markdown/types.
|
|
4
4
|
*
|
|
5
|
-
* Event
|
|
5
|
+
* Event class implementations (PrintCodeEvent, PrintTypeEvent, etc.) live in
|
|
6
|
+
* \@graphql-markdown/printer-legacy, which is the package that emits the events.
|
|
6
7
|
*
|
|
7
8
|
* @packageDocumentation
|
|
8
9
|
*/
|
|
9
10
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.PrintTypeEvent = exports.PrintCodeEvent = void 0;
|
|
11
|
-
const base_1 = require("./base");
|
|
12
|
-
/**
|
|
13
|
-
* Event emitted before/after generating the code block for a GraphQL type.
|
|
14
|
-
*
|
|
15
|
-
* The `output` property is mutable, allowing event handlers to modify
|
|
16
|
-
* the generated code before it's included in the documentation.
|
|
17
|
-
*
|
|
18
|
-
* @example
|
|
19
|
-
* ```typescript
|
|
20
|
-
* events.on(PrintTypeEvents.AFTER_PRINT_CODE, (event: PrintCodeEvent) => {
|
|
21
|
-
* // Add a comment to all generated code
|
|
22
|
-
* event.output = `# Auto-generated\n${event.output}`;
|
|
23
|
-
* });
|
|
24
|
-
* ```
|
|
25
|
-
*
|
|
26
|
-
* @category Events
|
|
27
|
-
*/
|
|
28
|
-
class PrintCodeEvent extends base_1.CancellableEvent {
|
|
29
|
-
/** Read-only event data */
|
|
30
|
-
data;
|
|
31
|
-
/**
|
|
32
|
-
* The generated code output.
|
|
33
|
-
* Handlers can modify this property to change the final output.
|
|
34
|
-
*/
|
|
35
|
-
output;
|
|
36
|
-
constructor(data, initialOutput, options) {
|
|
37
|
-
super(options);
|
|
38
|
-
this.data = data;
|
|
39
|
-
this.output = initialOutput;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
exports.PrintCodeEvent = PrintCodeEvent;
|
|
43
|
-
/**
|
|
44
|
-
* Event emitted before/after generating the full documentation for a GraphQL type.
|
|
45
|
-
*
|
|
46
|
-
* The `output` property is mutable, allowing event handlers to modify
|
|
47
|
-
* the complete generated documentation.
|
|
48
|
-
*
|
|
49
|
-
* @example
|
|
50
|
-
* ```typescript
|
|
51
|
-
* events.on(PrintTypeEvents.AFTER_PRINT_TYPE, (event: PrintTypeEvent) => {
|
|
52
|
-
* // Add a footer to all type documentation
|
|
53
|
-
* event.output = `${event.output}\n\n---\nGenerated by GraphQL-Markdown`;
|
|
54
|
-
* });
|
|
55
|
-
* ```
|
|
56
|
-
*
|
|
57
|
-
* @category Events
|
|
58
|
-
*/
|
|
59
|
-
class PrintTypeEvent extends base_1.CancellableEvent {
|
|
60
|
-
/** Read-only event data */
|
|
61
|
-
data;
|
|
62
|
-
/**
|
|
63
|
-
* The generated documentation output.
|
|
64
|
-
* Handlers can modify this property to change the final output.
|
|
65
|
-
*/
|
|
66
|
-
output;
|
|
67
|
-
constructor(data, initialOutput, options) {
|
|
68
|
-
super(options);
|
|
69
|
-
this.data = data;
|
|
70
|
-
this.output = initialOutput;
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
exports.PrintTypeEvent = PrintTypeEvent;
|
|
@@ -3,17 +3,16 @@
|
|
|
3
3
|
*
|
|
4
4
|
* @packageDocumentation
|
|
5
5
|
*/
|
|
6
|
-
import {
|
|
6
|
+
import type { CancellableEventOptions } from "@graphql-markdown/utils";
|
|
7
|
+
import { DataEvent } from "@graphql-markdown/utils";
|
|
7
8
|
/**
|
|
8
9
|
* Event emitted before/after rendering homepage.
|
|
9
10
|
*
|
|
10
11
|
* @category Events
|
|
11
12
|
*/
|
|
12
|
-
export declare class RenderHomepageEvent extends
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
outputDir: string;
|
|
16
|
-
};
|
|
13
|
+
export declare class RenderHomepageEvent extends DataEvent<{
|
|
14
|
+
outputDir: string;
|
|
15
|
+
}> {
|
|
17
16
|
constructor(data: {
|
|
18
17
|
outputDir: string;
|
|
19
18
|
}, options?: CancellableEventOptions);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render-homepage.d.ts","sourceRoot":"","sources":["../../src/events/render-homepage.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"render-homepage.d.ts","sourceRoot":"","sources":["../../src/events/render-homepage.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AACvE,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAEpD;;;;GAIG;AACH,qBAAa,mBAAoB,SAAQ,SAAS,CAAC;IACjD,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;IACA,YACE,IAAI,EAAE;QACJ,SAAS,EAAE,MAAM,CAAC;KACnB,EACD,OAAO,CAAC,EAAE,uBAAuB,EAGlC;CACF"}
|
|
@@ -6,18 +6,15 @@
|
|
|
6
6
|
*/
|
|
7
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
8
|
exports.RenderHomepageEvent = void 0;
|
|
9
|
-
const
|
|
9
|
+
const utils_1 = require("@graphql-markdown/utils");
|
|
10
10
|
/**
|
|
11
11
|
* Event emitted before/after rendering homepage.
|
|
12
12
|
*
|
|
13
13
|
* @category Events
|
|
14
14
|
*/
|
|
15
|
-
class RenderHomepageEvent extends
|
|
16
|
-
/** Event data containing output directory */
|
|
17
|
-
data;
|
|
15
|
+
class RenderHomepageEvent extends utils_1.DataEvent {
|
|
18
16
|
constructor(data, options) {
|
|
19
|
-
super(options);
|
|
20
|
-
this.data = data;
|
|
17
|
+
super(data, options);
|
|
21
18
|
}
|
|
22
19
|
}
|
|
23
20
|
exports.RenderHomepageEvent = RenderHomepageEvent;
|
|
@@ -3,17 +3,16 @@
|
|
|
3
3
|
*
|
|
4
4
|
* @packageDocumentation
|
|
5
5
|
*/
|
|
6
|
-
import {
|
|
6
|
+
import type { CancellableEventOptions } from "@graphql-markdown/utils";
|
|
7
|
+
import { DataEvent } from "@graphql-markdown/utils";
|
|
7
8
|
/**
|
|
8
9
|
* Event emitted before/after rendering root types.
|
|
9
10
|
*
|
|
10
11
|
* @category Events
|
|
11
12
|
*/
|
|
12
|
-
export declare class RenderRootTypesEvent extends
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
rootTypes: unknown;
|
|
16
|
-
};
|
|
13
|
+
export declare class RenderRootTypesEvent extends DataEvent<{
|
|
14
|
+
rootTypes: unknown;
|
|
15
|
+
}> {
|
|
17
16
|
constructor(data: {
|
|
18
17
|
rootTypes: unknown;
|
|
19
18
|
}, options?: CancellableEventOptions);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render-root-types.d.ts","sourceRoot":"","sources":["../../src/events/render-root-types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"render-root-types.d.ts","sourceRoot":"","sources":["../../src/events/render-root-types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AACvE,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAEpD;;;;GAIG;AACH,qBAAa,oBAAqB,SAAQ,SAAS,CAAC;IAClD,SAAS,EAAE,OAAO,CAAC;CACpB,CAAC;IACA,YACE,IAAI,EAAE;QACJ,SAAS,EAAE,OAAO,CAAC;KACpB,EACD,OAAO,CAAC,EAAE,uBAAuB,EAGlC;CACF"}
|
|
@@ -6,18 +6,15 @@
|
|
|
6
6
|
*/
|
|
7
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
8
|
exports.RenderRootTypesEvent = void 0;
|
|
9
|
-
const
|
|
9
|
+
const utils_1 = require("@graphql-markdown/utils");
|
|
10
10
|
/**
|
|
11
11
|
* Event emitted before/after rendering root types.
|
|
12
12
|
*
|
|
13
13
|
* @category Events
|
|
14
14
|
*/
|
|
15
|
-
class RenderRootTypesEvent extends
|
|
16
|
-
/** Event data containing root types */
|
|
17
|
-
data;
|
|
15
|
+
class RenderRootTypesEvent extends utils_1.DataEvent {
|
|
18
16
|
constructor(data, options) {
|
|
19
|
-
super(options);
|
|
20
|
-
this.data = data;
|
|
17
|
+
super(data, options);
|
|
21
18
|
}
|
|
22
19
|
}
|
|
23
20
|
exports.RenderRootTypesEvent = RenderRootTypesEvent;
|
|
@@ -3,18 +3,17 @@
|
|
|
3
3
|
*
|
|
4
4
|
* @packageDocumentation
|
|
5
5
|
*/
|
|
6
|
-
import {
|
|
6
|
+
import type { CancellableEventOptions } from "@graphql-markdown/utils";
|
|
7
|
+
import { DataEvent } from "@graphql-markdown/utils";
|
|
7
8
|
/**
|
|
8
9
|
* Event emitted before/after rendering type entities.
|
|
9
10
|
*
|
|
10
11
|
* @category Events
|
|
11
12
|
*/
|
|
12
|
-
export declare class RenderTypeEntitiesEvent extends
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
filePath: string;
|
|
17
|
-
};
|
|
13
|
+
export declare class RenderTypeEntitiesEvent extends DataEvent<{
|
|
14
|
+
name: string;
|
|
15
|
+
filePath: string;
|
|
16
|
+
}> {
|
|
18
17
|
constructor(data: {
|
|
19
18
|
name: string;
|
|
20
19
|
filePath: string;
|
|
@@ -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,EAAE,
|
|
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,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AACvE,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAEpD;;;;GAIG;AACH,qBAAa,uBAAwB,SAAQ,SAAS,CAAC;IACrD,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;IACA,YACE,IAAI,EAAE;QACJ,IAAI,EAAE,MAAM,CAAC;QACb,QAAQ,EAAE,MAAM,CAAC;KAClB,EACD,OAAO,CAAC,EAAE,uBAAuB,EAGlC;CACF"}
|
|
@@ -6,18 +6,15 @@
|
|
|
6
6
|
*/
|
|
7
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
8
|
exports.RenderTypeEntitiesEvent = void 0;
|
|
9
|
-
const
|
|
9
|
+
const utils_1 = require("@graphql-markdown/utils");
|
|
10
10
|
/**
|
|
11
11
|
* Event emitted before/after rendering type entities.
|
|
12
12
|
*
|
|
13
13
|
* @category Events
|
|
14
14
|
*/
|
|
15
|
-
class RenderTypeEntitiesEvent extends
|
|
16
|
-
/** Event data containing name and file path */
|
|
17
|
-
data;
|
|
15
|
+
class RenderTypeEntitiesEvent extends utils_1.DataEvent {
|
|
18
16
|
constructor(data, options) {
|
|
19
|
-
super(options);
|
|
20
|
-
this.data = data;
|
|
17
|
+
super(data, options);
|
|
21
18
|
}
|
|
22
19
|
}
|
|
23
20
|
exports.RenderTypeEntitiesEvent = RenderTypeEntitiesEvent;
|
|
@@ -4,19 +4,18 @@
|
|
|
4
4
|
* @packageDocumentation
|
|
5
5
|
*/
|
|
6
6
|
import type { GraphQLSchema, Maybe, SchemaMap } from "@graphql-markdown/types";
|
|
7
|
-
import {
|
|
7
|
+
import type { CancellableEventOptions } from "@graphql-markdown/utils";
|
|
8
|
+
import { DataEvent } from "@graphql-markdown/utils";
|
|
8
9
|
/**
|
|
9
10
|
* Event emitted before/after loading a GraphQL schema.
|
|
10
11
|
*
|
|
11
12
|
* @category Events
|
|
12
13
|
*/
|
|
13
|
-
export declare class SchemaEvent extends
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
rootTypes?: Maybe<SchemaMap>;
|
|
19
|
-
};
|
|
14
|
+
export declare class SchemaEvent extends DataEvent<{
|
|
15
|
+
schemaLocation?: string;
|
|
16
|
+
schema?: Maybe<GraphQLSchema>;
|
|
17
|
+
rootTypes?: Maybe<SchemaMap>;
|
|
18
|
+
}> {
|
|
20
19
|
constructor(data: {
|
|
21
20
|
schemaLocation?: string;
|
|
22
21
|
schema?: Maybe<GraphQLSchema>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema-load.d.ts","sourceRoot":"","sources":["../../src/events/schema-load.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAC/E,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"schema-load.d.ts","sourceRoot":"","sources":["../../src/events/schema-load.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAC/E,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AACvE,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAEpD;;;;GAIG;AACH,qBAAa,WAAY,SAAQ,SAAS,CAAC;IACzC,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,MAAM,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC,CAAC;IAC9B,SAAS,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;CAC9B,CAAC;IACA,YACE,IAAI,EAAE;QACJ,cAAc,CAAC,EAAE,MAAM,CAAC;QACxB,MAAM,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC,CAAC;QAC9B,SAAS,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;KAC9B,EACD,OAAO,CAAC,EAAE,uBAAuB,EAGlC;CACF"}
|
|
@@ -6,18 +6,15 @@
|
|
|
6
6
|
*/
|
|
7
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
8
|
exports.SchemaEvent = void 0;
|
|
9
|
-
const
|
|
9
|
+
const utils_1 = require("@graphql-markdown/utils");
|
|
10
10
|
/**
|
|
11
11
|
* Event emitted before/after loading a GraphQL schema.
|
|
12
12
|
*
|
|
13
13
|
* @category Events
|
|
14
14
|
*/
|
|
15
|
-
class SchemaEvent extends
|
|
16
|
-
/** Event data containing schema location, schema, and root types */
|
|
17
|
-
data;
|
|
15
|
+
class SchemaEvent extends utils_1.DataEvent {
|
|
18
16
|
constructor(data, options) {
|
|
19
|
-
super(options);
|
|
20
|
-
this.data = data;
|
|
17
|
+
super(data, options);
|
|
21
18
|
}
|
|
22
19
|
}
|
|
23
20
|
exports.SchemaEvent = SchemaEvent;
|
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;AA+BjC;;;;;;GAMG;AACH,eAAO,MAAM,cAAc;;;CAGjB,CAAC;AAgBX;;;;;;;;;GASG;AACH,eAAO,MAAM,aAAa,8DAczB,CAAC;AAgBF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,oBAAoB,GAAI,CAAC,4DAsBrC,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,yBAAyB,yEAkDrC,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,iBAAiB,6FAe7B,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,sBAAsB,wHAgBlC,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,4BAA4B,qKA0BxC,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,qBAAqB,
|
|
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;AA+BjC;;;;;;GAMG;AACH,eAAO,MAAM,cAAc;;;CAGjB,CAAC;AAgBX;;;;;;;;;GASG;AACH,eAAO,MAAM,aAAa,8DAczB,CAAC;AAgBF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,oBAAoB,GAAI,CAAC,4DAsBrC,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,yBAAyB,yEAkDrC,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,iBAAiB,6FAe7B,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,sBAAsB,wHAgBlC,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,4BAA4B,qKA0BxC,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,qBAAqB,qUAwNjC,CAAC"}
|
package/dist/generator.js
CHANGED
|
@@ -80,7 +80,7 @@ const SEC_DECIMALS = 3;
|
|
|
80
80
|
*/
|
|
81
81
|
const loadMDXModule = async (mdxParser) => {
|
|
82
82
|
return mdxParser !== undefined && mdxParser !== null
|
|
83
|
-
?
|
|
83
|
+
? import(mdxParser).catch((error) => {
|
|
84
84
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
85
85
|
(0, logger_1.log)(`An error occurred while loading MDX formatter "${mdxParser}": ${errorMessage}`, logger_1.LogLevel.warn);
|
|
86
86
|
return undefined;
|
|
@@ -331,6 +331,7 @@ const generateDocFromSchema = async ({ baseURL, customDirective, diffMethod, doc
|
|
|
331
331
|
onlyDocDirectives,
|
|
332
332
|
printTypeOptions,
|
|
333
333
|
skipDocDirectives,
|
|
334
|
+
sectionHeaderId: docOptions?.sectionHeaderId,
|
|
334
335
|
}, formatter, mdxDeclaration,
|
|
335
336
|
// Pass event emitter to enable print events
|
|
336
337
|
events);
|
package/dist/graphql-config.js
CHANGED
|
@@ -1,37 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
3
|
exports.loadConfiguration = exports.setLoaderOptions = exports.graphQLConfigExtension = exports.EXTENSION_NAME = void 0;
|
|
37
4
|
const logger_1 = require("@graphql-markdown/logger");
|
|
@@ -141,7 +108,7 @@ const loadConfiguration = async (id, options, { throwOnMissing, throwOnEmpty } =
|
|
|
141
108
|
return undefined;
|
|
142
109
|
}
|
|
143
110
|
try {
|
|
144
|
-
graphQLConfig = await
|
|
111
|
+
graphQLConfig = await import("graphql-config");
|
|
145
112
|
}
|
|
146
113
|
catch {
|
|
147
114
|
(0, logger_1.log)("Cannot find module 'graphql-config'!");
|
package/dist/index.d.ts
CHANGED
|
@@ -13,12 +13,12 @@ export { RenderHomepageEvents } from "./events/render-homepage-events";
|
|
|
13
13
|
export { RenderTypeEntitiesEvents } from "./events/render-type-entities-events";
|
|
14
14
|
export { GenerateIndexMetafileEvents } from "./events/generate-index-metafile-events";
|
|
15
15
|
export { PrintTypeEvents } from "./events/print-type-events";
|
|
16
|
-
export type { CancellableEvent } from "./events/base";
|
|
17
16
|
export type { SchemaEvent as SchemaLoadEvent } from "./events/schema-load";
|
|
18
17
|
export type { DiffCheckEvent } from "./events/diff-check";
|
|
19
18
|
export type { RenderRootTypesEvent } from "./events/render-root-types";
|
|
20
19
|
export type { RenderHomepageEvent } from "./events/render-homepage";
|
|
21
20
|
export type { RenderTypeEntitiesEvent } from "./events/render-type-entities";
|
|
22
21
|
export type { GenerateIndexMetafileEvent } from "./events/generate-index-metafile";
|
|
23
|
-
export type { PrintCodeEvent, PrintCodeEventData, PrintTypeEvent, PrintTypeEventData, } from "
|
|
22
|
+
export type { ComposePageTypeEventData, IPrintCodeEvent, IPrintTypeEvent, PageSection, PageSections, PrintCodeEvent, PrintCodeEventData, PrintTypeEvent, PrintTypeEventData, } from "@graphql-markdown/types";
|
|
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;AAGH,OAAO,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAGvC,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,KAAK,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC1E,OAAO,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAGjD,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAC1E,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AACvE,OAAO,EAAE,wBAAwB,EAAE,MAAM,sCAAsC,CAAC;AAChF,OAAO,EAAE,2BAA2B,EAAE,MAAM,yCAAyC,CAAC;AACtF,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAG7D,YAAY,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAGvC,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,KAAK,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC1E,OAAO,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAGjD,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAC1E,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AACvE,OAAO,EAAE,wBAAwB,EAAE,MAAM,sCAAsC,CAAC;AAChF,OAAO,EAAE,2BAA2B,EAAE,MAAM,yCAAyC,CAAC;AACtF,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAG7D,YAAY,EAAE,WAAW,IAAI,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC3E,YAAY,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1D,YAAY,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AACvE,YAAY,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AACpE,YAAY,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAC;AAC7E,YAAY,EAAE,0BAA0B,EAAE,MAAM,kCAAkC,CAAC;AACnF,YAAY,EACV,wBAAwB,EACxB,eAAe,EACf,eAAe,EACf,WAAW,EACX,YAAY,EACZ,cAAc,EACd,kBAAkB,EAClB,cAAc,EACd,kBAAkB,GACnB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
/* istanbul ignore file */
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
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
|
+
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;
|
|
8
8
|
const generator_1 = require("./generator");
|
|
9
9
|
Object.defineProperty(exports, "generateDocFromSchema", { enumerable: true, get: function () { return generator_1.generateDocFromSchema; } });
|
|
10
10
|
const config_1 = require("./config");
|
|
@@ -32,3 +32,5 @@ const generate_index_metafile_events_1 = require("./events/generate-index-metafi
|
|
|
32
32
|
Object.defineProperty(exports, "GenerateIndexMetafileEvents", { enumerable: true, get: function () { return generate_index_metafile_events_1.GenerateIndexMetafileEvents; } });
|
|
33
33
|
const print_type_events_1 = require("./events/print-type-events");
|
|
34
34
|
Object.defineProperty(exports, "PrintTypeEvents", { enumerable: true, get: function () { return print_type_events_1.PrintTypeEvents; } });
|
|
35
|
+
const utils_1 = require("@graphql-markdown/utils");
|
|
36
|
+
Object.defineProperty(exports, "CancellableEvent", { enumerable: true, get: function () { return utils_1.CancellableEvent; } });
|
|
@@ -88,19 +88,6 @@ export declare class OptionBuilder<T extends Record<string, unknown>> {
|
|
|
88
88
|
* ```
|
|
89
89
|
*/
|
|
90
90
|
addFromCli<K extends keyof T>(value: Maybe<T[K]>, key: K): this;
|
|
91
|
-
/**
|
|
92
|
-
* Sets a value if it's not null or undefined, respecting precedence.
|
|
93
|
-
* Internal helper method used by addDefault, addFromConfig, and addFromCli.
|
|
94
|
-
*
|
|
95
|
-
* Only updates the merged value if the source has equal or higher precedence
|
|
96
|
-
* than the currently stored source. Precedence order: default < config < cli.
|
|
97
|
-
*
|
|
98
|
-
* @param value - The value to set
|
|
99
|
-
* @param key - The key to set
|
|
100
|
-
* @param source - The source of this value ('default', 'config', or 'cli')
|
|
101
|
-
* @returns This builder for method chaining
|
|
102
|
-
*/
|
|
103
|
-
private setIfProvided;
|
|
104
91
|
/**
|
|
105
92
|
* Transforms a value using a function if the key exists.
|
|
106
93
|
* Useful for processing values after they've been set.
|
|
@@ -153,5 +140,18 @@ export declare class OptionBuilder<T extends Record<string, unknown>> {
|
|
|
153
140
|
* @returns The constructed options object with type `Partial<T>` (may not have all properties of `T`)
|
|
154
141
|
*/
|
|
155
142
|
build(): Partial<T>;
|
|
143
|
+
/**
|
|
144
|
+
* Sets a value if it's not null or undefined, respecting precedence.
|
|
145
|
+
* Internal helper method used by addDefault, addFromConfig, and addFromCli.
|
|
146
|
+
*
|
|
147
|
+
* Only updates the merged value if the source has equal or higher precedence
|
|
148
|
+
* than the currently stored source. Precedence order: `default < config < cli`.
|
|
149
|
+
*
|
|
150
|
+
* @param value - The value to set
|
|
151
|
+
* @param key - The key to set
|
|
152
|
+
* @param source - The source of this value ('default', 'config', or 'cli')
|
|
153
|
+
* @returns This builder for method chaining
|
|
154
|
+
*/
|
|
155
|
+
private setIfProvided;
|
|
156
156
|
}
|
|
157
157
|
//# sourceMappingURL=builder.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"builder.d.ts","sourceRoot":"","sources":["../../src/options/builder.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAOrD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,qBAAa,aAAa,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAC1D,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,gBAAgB,CAItC;IAEF,OAAO,CAAC,MAAM,CAAkB;IAChC,OAAO,CAAC,QAAQ,CAAC,OAAO,
|
|
1
|
+
{"version":3,"file":"builder.d.ts","sourceRoot":"","sources":["../../src/options/builder.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAOrD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,qBAAa,aAAa,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAC1D,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,gBAAgB,CAItC;IAEF,OAAO,CAAC,MAAM,CAAkB;IAChC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAoC;IAE5D;;;;;;;;;;;;;OAaG;IACH,UAAU,CAAC,CAAC,SAAS,MAAM,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,IAAI,CAE9D;IAED;;;;;;;;;;;;;OAaG;IACH,aAAa,CAAC,CAAC,SAAS,MAAM,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,IAAI,CAEjE;IAED;;;;;;;;;;;;;OAaG;IACH,UAAU,CAAC,CAAC,SAAS,MAAM,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,IAAI,CAE9D;IAED;;;;;;;;;;;;OAYG;IACH,SAAS,CAAC,CAAC,SAAS,MAAM,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,CAKhE;IAED;;;;;;;;;;;;;OAaG;IACH,WAAW,CAAC,CAAC,SAAS,MAAM,CAAC,EAC3B,GAAG,EAAE,CAAC,EACN,SAAS,EAAE,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,KAAK,OAAO,EAC1C,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GACpB,IAAI,CAKN;IAED;;;;;;;;OAQG;IACH,GAAG,CAAC,CAAC,SAAS,MAAM,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,SAAS,CAS/C;IAED;;;;;;;;;;;OAWG;IACH,KAAK,IAAI,OAAO,CAAC,CAAC,CAAC,CAalB;IAED;;;;;;;;;;;OAWG;IACH,OAAO,CAAC,aAAa;CAmBtB"}
|
package/dist/options/builder.js
CHANGED
|
@@ -100,31 +100,6 @@ class OptionBuilder {
|
|
|
100
100
|
addFromCli(value, key) {
|
|
101
101
|
return this.setIfProvided(value, key, "cli");
|
|
102
102
|
}
|
|
103
|
-
/**
|
|
104
|
-
* Sets a value if it's not null or undefined, respecting precedence.
|
|
105
|
-
* Internal helper method used by addDefault, addFromConfig, and addFromCli.
|
|
106
|
-
*
|
|
107
|
-
* Only updates the merged value if the source has equal or higher precedence
|
|
108
|
-
* than the currently stored source. Precedence order: default < config < cli.
|
|
109
|
-
*
|
|
110
|
-
* @param value - The value to set
|
|
111
|
-
* @param key - The key to set
|
|
112
|
-
* @param source - The source of this value ('default', 'config', or 'cli')
|
|
113
|
-
* @returns This builder for method chaining
|
|
114
|
-
*/
|
|
115
|
-
setIfProvided(value, key, source) {
|
|
116
|
-
if (value !== null && value !== undefined) {
|
|
117
|
-
const currentSource = this.sources.get(key);
|
|
118
|
-
const shouldUpdate = !currentSource ||
|
|
119
|
-
OptionBuilder.PRECEDENCE_ORDER[source] >=
|
|
120
|
-
OptionBuilder.PRECEDENCE_ORDER[currentSource];
|
|
121
|
-
if (shouldUpdate) {
|
|
122
|
-
this.merged[key] = value;
|
|
123
|
-
this.sources.set(key, source);
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
return this;
|
|
127
|
-
}
|
|
128
103
|
/**
|
|
129
104
|
* Transforms a value using a function if the key exists.
|
|
130
105
|
* Useful for processing values after they've been set.
|
|
@@ -211,5 +186,30 @@ class OptionBuilder {
|
|
|
211
186
|
}
|
|
212
187
|
return result;
|
|
213
188
|
}
|
|
189
|
+
/**
|
|
190
|
+
* Sets a value if it's not null or undefined, respecting precedence.
|
|
191
|
+
* Internal helper method used by addDefault, addFromConfig, and addFromCli.
|
|
192
|
+
*
|
|
193
|
+
* Only updates the merged value if the source has equal or higher precedence
|
|
194
|
+
* than the currently stored source. Precedence order: `default < config < cli`.
|
|
195
|
+
*
|
|
196
|
+
* @param value - The value to set
|
|
197
|
+
* @param key - The key to set
|
|
198
|
+
* @param source - The source of this value ('default', 'config', or 'cli')
|
|
199
|
+
* @returns This builder for method chaining
|
|
200
|
+
*/
|
|
201
|
+
setIfProvided(value, key, source) {
|
|
202
|
+
if (value !== null && value !== undefined) {
|
|
203
|
+
const currentSource = this.sources.get(key);
|
|
204
|
+
const shouldUpdate = !currentSource ||
|
|
205
|
+
OptionBuilder.PRECEDENCE_ORDER[source] >=
|
|
206
|
+
OptionBuilder.PRECEDENCE_ORDER[currentSource];
|
|
207
|
+
if (shouldUpdate) {
|
|
208
|
+
this.merged[key] = value;
|
|
209
|
+
this.sources.set(key, source);
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
return this;
|
|
213
|
+
}
|
|
214
214
|
}
|
|
215
215
|
exports.OptionBuilder = OptionBuilder;
|