@graphql-markdown/core 1.21.1 → 1.21.2
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/package.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"bugs": {
|
|
6
6
|
"url": "https://github.com/graphql-markdown/graphql-markdown/issues"
|
|
7
7
|
},
|
|
8
|
-
"version": "1.21.
|
|
8
|
+
"version": "1.21.2",
|
|
9
9
|
"license": "MIT",
|
|
10
10
|
"repository": {
|
|
11
11
|
"type": "git",
|
|
@@ -65,11 +65,11 @@
|
|
|
65
65
|
"prettier": "prettier \"{src,tests,assets}/**/*.{ts,js,json,md,gql}\" --check",
|
|
66
66
|
"prettier:fix": "prettier \"{src,tests,assets}/**/*.{ts,js,json,md,gql}\" --write",
|
|
67
67
|
"ts:check": "tsgo --noEmit",
|
|
68
|
-
"test": "
|
|
69
|
-
"test:unit": "
|
|
70
|
-
"test:integration": "
|
|
71
|
-
"test:ci": "
|
|
72
|
-
"test:watch": "
|
|
68
|
+
"test": "vitest run --passWithNoTests",
|
|
69
|
+
"test:unit": "vitest run --passWithNoTests tests/unit",
|
|
70
|
+
"test:integration": "vitest run --passWithNoTests tests/integration",
|
|
71
|
+
"test:ci": "vitest run --passWithNoTests --silent --sequence.shuffle",
|
|
72
|
+
"test:watch": "vitest --watch"
|
|
73
73
|
},
|
|
74
74
|
"dependencies": {
|
|
75
75
|
"@fastify/deepmerge": "^3.2.1",
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Directive name normalization and processing utilities.
|
|
3
|
-
*
|
|
4
|
-
* This module consolidates utilities for handling directive names from multiple
|
|
5
|
-
* sources (CLI, config file, etc.) ensuring consistent normalization across
|
|
6
|
-
* the application.
|
|
7
|
-
*
|
|
8
|
-
* @packageDocumentation
|
|
9
|
-
*/
|
|
10
|
-
import type { DirectiveName, Maybe } from "@graphql-markdown/types";
|
|
11
|
-
/**
|
|
12
|
-
* Normalizes directive names from multiple sources into a single flattened array.
|
|
13
|
-
*
|
|
14
|
-
* This function:
|
|
15
|
-
* 1. Accepts multiple directive name arrays from different sources
|
|
16
|
-
* 2. Filters out null/undefined values and empty arrays
|
|
17
|
-
* 3. Flattens them into a single array
|
|
18
|
-
* 4. Returns the normalized array (may contain duplicates if sources contain duplicates)
|
|
19
|
-
*
|
|
20
|
-
* Useful when combining directives from CLI, config file, and environment sources.
|
|
21
|
-
*
|
|
22
|
-
* @param sources - Multiple arrays of directive names or undefined/null values
|
|
23
|
-
* @returns A single array of normalized directive names (may contain duplicates)
|
|
24
|
-
*
|
|
25
|
-
* @example
|
|
26
|
-
* ```typescript
|
|
27
|
-
* import { normalizeDirectiveNames } from "@graphql-markdown/core/directives/normalize";
|
|
28
|
-
*
|
|
29
|
-
* const cliDirectives = ["@example", "@internal"];
|
|
30
|
-
* const configDirectives = ["@auth"];
|
|
31
|
-
*
|
|
32
|
-
* const all = normalizeDirectiveNames(cliDirectives, configDirectives);
|
|
33
|
-
* // Result: ["@example", "@internal", "@auth"]
|
|
34
|
-
*
|
|
35
|
-
* // Safely handles undefined:
|
|
36
|
-
* const safe = normalizeDirectiveNames(cliDirectives, undefined, configDirectives);
|
|
37
|
-
* // Result: ["@example", "@internal", "@auth"]
|
|
38
|
-
* ```
|
|
39
|
-
*/
|
|
40
|
-
export declare const normalizeDirectiveNames: (...sources: (DirectiveName[] | Maybe<DirectiveName[]>)[]) => DirectiveName[];
|
|
41
|
-
/**
|
|
42
|
-
* Removes duplicate directive names from an array while preserving order.
|
|
43
|
-
*
|
|
44
|
-
* @param directives - Array of directive names that may contain duplicates
|
|
45
|
-
* @returns A new array with duplicate directive names removed
|
|
46
|
-
*
|
|
47
|
-
* @example
|
|
48
|
-
* ```typescript
|
|
49
|
-
* import { uniqueDirectiveNames } from "@graphql-markdown/core/directives/normalize";
|
|
50
|
-
*
|
|
51
|
-
* const directives = ["@auth", "@example", "@auth", "@internal"];
|
|
52
|
-
* const unique = uniqueDirectiveNames(directives);
|
|
53
|
-
* // Result: ["@auth", "@example", "@internal"]
|
|
54
|
-
* ```
|
|
55
|
-
*/
|
|
56
|
-
export declare const uniqueDirectiveNames: (directives: DirectiveName[]) => DirectiveName[];
|
|
57
|
-
/**
|
|
58
|
-
* Combines and deduplicates directive names from multiple sources in one step.
|
|
59
|
-
*
|
|
60
|
-
* This is a convenience function that combines normalizeDirectiveNames
|
|
61
|
-
* with uniqueDirectiveNames for the common case where you need both
|
|
62
|
-
* normalization and deduplication.
|
|
63
|
-
*
|
|
64
|
-
* @param sources - Multiple arrays of directive names or undefined/null values
|
|
65
|
-
* @returns A single array of deduplicated directive names
|
|
66
|
-
*
|
|
67
|
-
* @example
|
|
68
|
-
* ```typescript
|
|
69
|
-
* import { combineDirectiveNames } from "@graphql-markdown/core/directives/normalize";
|
|
70
|
-
*
|
|
71
|
-
* const cliDirectives = ["@example", "@internal"];
|
|
72
|
-
* const configDirectives = ["@auth", "@example"]; // @example is duplicate
|
|
73
|
-
*
|
|
74
|
-
* const all = combineDirectiveNames(cliDirectives, configDirectives);
|
|
75
|
-
* // Result: ["@example", "@internal", "@auth"]
|
|
76
|
-
* ```
|
|
77
|
-
*/
|
|
78
|
-
export declare const combineDirectiveNames: (...sources: (DirectiveName[] | Maybe<DirectiveName[]>)[]) => DirectiveName[];
|
|
79
|
-
//# sourceMappingURL=normalize.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"normalize.d.ts","sourceRoot":"","sources":["../../src/directives/normalize.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAEpE;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,eAAO,MAAM,uBAAuB,eACtB,CAAC,aAAa,EAAE,GAAG,KAAK,CAAC,aAAa,EAAE,CAAC,CAAC,EAAE,KACvD,aAAa,EAMf,CAAC;AAEF;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,oBAAoB,eACnB,aAAa,EAAE,KAC1B,aAAa,EAEf,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,qBAAqB,eACpB,CAAC,aAAa,EAAE,GAAG,KAAK,CAAC,aAAa,EAAE,CAAC,CAAC,EAAE,KACvD,aAAa,EAEf,CAAC"}
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Directive name normalization and processing utilities.
|
|
4
|
-
*
|
|
5
|
-
* This module consolidates utilities for handling directive names from multiple
|
|
6
|
-
* sources (CLI, config file, etc.) ensuring consistent normalization across
|
|
7
|
-
* the application.
|
|
8
|
-
*
|
|
9
|
-
* @packageDocumentation
|
|
10
|
-
*/
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.combineDirectiveNames = exports.uniqueDirectiveNames = exports.normalizeDirectiveNames = void 0;
|
|
13
|
-
/**
|
|
14
|
-
* Normalizes directive names from multiple sources into a single flattened array.
|
|
15
|
-
*
|
|
16
|
-
* This function:
|
|
17
|
-
* 1. Accepts multiple directive name arrays from different sources
|
|
18
|
-
* 2. Filters out null/undefined values and empty arrays
|
|
19
|
-
* 3. Flattens them into a single array
|
|
20
|
-
* 4. Returns the normalized array (may contain duplicates if sources contain duplicates)
|
|
21
|
-
*
|
|
22
|
-
* Useful when combining directives from CLI, config file, and environment sources.
|
|
23
|
-
*
|
|
24
|
-
* @param sources - Multiple arrays of directive names or undefined/null values
|
|
25
|
-
* @returns A single array of normalized directive names (may contain duplicates)
|
|
26
|
-
*
|
|
27
|
-
* @example
|
|
28
|
-
* ```typescript
|
|
29
|
-
* import { normalizeDirectiveNames } from "@graphql-markdown/core/directives/normalize";
|
|
30
|
-
*
|
|
31
|
-
* const cliDirectives = ["@example", "@internal"];
|
|
32
|
-
* const configDirectives = ["@auth"];
|
|
33
|
-
*
|
|
34
|
-
* const all = normalizeDirectiveNames(cliDirectives, configDirectives);
|
|
35
|
-
* // Result: ["@example", "@internal", "@auth"]
|
|
36
|
-
*
|
|
37
|
-
* // Safely handles undefined:
|
|
38
|
-
* const safe = normalizeDirectiveNames(cliDirectives, undefined, configDirectives);
|
|
39
|
-
* // Result: ["@example", "@internal", "@auth"]
|
|
40
|
-
* ```
|
|
41
|
-
*/
|
|
42
|
-
const normalizeDirectiveNames = (...sources) => {
|
|
43
|
-
return sources
|
|
44
|
-
.filter((s) => {
|
|
45
|
-
return Array.isArray(s) && s.length > 0;
|
|
46
|
-
})
|
|
47
|
-
.flat();
|
|
48
|
-
};
|
|
49
|
-
exports.normalizeDirectiveNames = normalizeDirectiveNames;
|
|
50
|
-
/**
|
|
51
|
-
* Removes duplicate directive names from an array while preserving order.
|
|
52
|
-
*
|
|
53
|
-
* @param directives - Array of directive names that may contain duplicates
|
|
54
|
-
* @returns A new array with duplicate directive names removed
|
|
55
|
-
*
|
|
56
|
-
* @example
|
|
57
|
-
* ```typescript
|
|
58
|
-
* import { uniqueDirectiveNames } from "@graphql-markdown/core/directives/normalize";
|
|
59
|
-
*
|
|
60
|
-
* const directives = ["@auth", "@example", "@auth", "@internal"];
|
|
61
|
-
* const unique = uniqueDirectiveNames(directives);
|
|
62
|
-
* // Result: ["@auth", "@example", "@internal"]
|
|
63
|
-
* ```
|
|
64
|
-
*/
|
|
65
|
-
const uniqueDirectiveNames = (directives) => {
|
|
66
|
-
return Array.from(new Set(directives));
|
|
67
|
-
};
|
|
68
|
-
exports.uniqueDirectiveNames = uniqueDirectiveNames;
|
|
69
|
-
/**
|
|
70
|
-
* Combines and deduplicates directive names from multiple sources in one step.
|
|
71
|
-
*
|
|
72
|
-
* This is a convenience function that combines normalizeDirectiveNames
|
|
73
|
-
* with uniqueDirectiveNames for the common case where you need both
|
|
74
|
-
* normalization and deduplication.
|
|
75
|
-
*
|
|
76
|
-
* @param sources - Multiple arrays of directive names or undefined/null values
|
|
77
|
-
* @returns A single array of deduplicated directive names
|
|
78
|
-
*
|
|
79
|
-
* @example
|
|
80
|
-
* ```typescript
|
|
81
|
-
* import { combineDirectiveNames } from "@graphql-markdown/core/directives/normalize";
|
|
82
|
-
*
|
|
83
|
-
* const cliDirectives = ["@example", "@internal"];
|
|
84
|
-
* const configDirectives = ["@auth", "@example"]; // @example is duplicate
|
|
85
|
-
*
|
|
86
|
-
* const all = combineDirectiveNames(cliDirectives, configDirectives);
|
|
87
|
-
* // Result: ["@example", "@internal", "@auth"]
|
|
88
|
-
* ```
|
|
89
|
-
*/
|
|
90
|
-
const combineDirectiveNames = (...sources) => {
|
|
91
|
-
return (0, exports.uniqueDirectiveNames)((0, exports.normalizeDirectiveNames)(...sources));
|
|
92
|
-
};
|
|
93
|
-
exports.combineDirectiveNames = combineDirectiveNames;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Print type interfaces — re-exported from \@graphql-markdown/types.
|
|
3
|
-
*
|
|
4
|
-
* Event class implementations (PrintCodeEvent, PrintTypeEvent, etc.) live in
|
|
5
|
-
* \@graphql-markdown/printer-legacy, which is the package that emits the events.
|
|
6
|
-
*
|
|
7
|
-
* @packageDocumentation
|
|
8
|
-
*/
|
|
9
|
-
export type { PageSection, PageSections, PrintCodeEventData, PrintTypeEventData, ComposePageTypeEventData, } from "@graphql-markdown/types";
|
|
10
|
-
//# sourceMappingURL=print-type.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
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,10 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Print type interfaces — re-exported from \@graphql-markdown/types.
|
|
4
|
-
*
|
|
5
|
-
* Event class implementations (PrintCodeEvent, PrintTypeEvent, etc.) live in
|
|
6
|
-
* \@graphql-markdown/printer-legacy, which is the package that emits the events.
|
|
7
|
-
*
|
|
8
|
-
* @packageDocumentation
|
|
9
|
-
*/
|
|
10
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|