@graphql-codegen/typescript-document-nodes 2.3.3-alpha-0814e49cc.0 → 2.3.3
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 +4 -4
- package/typings/index.d.cts +94 -0
- package/typings/visitor.d.cts +11 -0
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@graphql-codegen/typescript-document-nodes",
|
|
3
|
-
"version": "2.3.3
|
|
3
|
+
"version": "2.3.3",
|
|
4
4
|
"description": "GraphQL Code Generator plugin for generating TypeScript modules with embedded GraphQL document nodes",
|
|
5
5
|
"peerDependencies": {
|
|
6
6
|
"graphql": "^0.8.0 || ^0.9.0 || ^0.10.0 || ^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"
|
|
7
7
|
},
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"@graphql-codegen/plugin-helpers": "^2.6.
|
|
10
|
-
"@graphql-codegen/visitor-plugin-common": "2.12.1
|
|
9
|
+
"@graphql-codegen/plugin-helpers": "^2.6.2",
|
|
10
|
+
"@graphql-codegen/visitor-plugin-common": "2.12.1",
|
|
11
11
|
"auto-bind": "~4.0.0",
|
|
12
12
|
"tslib": "~2.4.0"
|
|
13
13
|
},
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"exports": {
|
|
28
28
|
".": {
|
|
29
29
|
"require": {
|
|
30
|
-
"types": "./typings/index.d.
|
|
30
|
+
"types": "./typings/index.d.cts",
|
|
31
31
|
"default": "./cjs/index.js"
|
|
32
32
|
},
|
|
33
33
|
"import": {
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { PluginFunction, PluginValidateFn } from '@graphql-codegen/plugin-helpers';
|
|
2
|
+
import { NamingConvention, RawClientSideBasePluginConfig } from '@graphql-codegen/visitor-plugin-common';
|
|
3
|
+
/**
|
|
4
|
+
* @description This plugin generates TypeScript source `.ts` file from GraphQL files `.graphql`.
|
|
5
|
+
*/
|
|
6
|
+
export interface TypeScriptDocumentNodesRawPluginConfig extends RawClientSideBasePluginConfig {
|
|
7
|
+
/**
|
|
8
|
+
* @default change-case-all#pascalCase
|
|
9
|
+
* @description Allow you to override the naming convention of the output.
|
|
10
|
+
* You can either override all namings, or specify an object with specific custom naming convention per output.
|
|
11
|
+
* The format of the converter must be a valid `module#method`.
|
|
12
|
+
* Allowed values for specific output are: `typeNames`, `enumValues`.
|
|
13
|
+
* You can also use "keep" to keep all GraphQL names as-is.
|
|
14
|
+
* Additionally, you can set `transformUnderscore` to `true` if you want to override the default behavior,
|
|
15
|
+
* which is to preserve underscores.
|
|
16
|
+
*
|
|
17
|
+
* Available case functions in `change-case-all` are `camelCase`, `capitalCase`, `constantCase`, `dotCase`, `headerCase`, `noCase`, `paramCase`, `pascalCase`, `pathCase`, `sentenceCase`, `snakeCase`, `lowerCase`, `localeLowerCase`, `lowerCaseFirst`, `spongeCase`, `titleCase`, `upperCase`, `localeUpperCase` and `upperCaseFirst`
|
|
18
|
+
* [See more](https://github.com/btxtiger/change-case-all)
|
|
19
|
+
*
|
|
20
|
+
* @exampleMarkdown
|
|
21
|
+
* ## Override All Names
|
|
22
|
+
* ```yaml
|
|
23
|
+
* config:
|
|
24
|
+
* namingConvention: change-case-all#lowerCase
|
|
25
|
+
* ```
|
|
26
|
+
*
|
|
27
|
+
* ## Upper-case enum values
|
|
28
|
+
* ```yaml
|
|
29
|
+
* config:
|
|
30
|
+
* namingConvention:
|
|
31
|
+
* typeNames: change-case-all#pascalCase
|
|
32
|
+
* enumValues: change-case-all#upperCase
|
|
33
|
+
* ```
|
|
34
|
+
*
|
|
35
|
+
* ## Keep name as-is
|
|
36
|
+
* ```yaml
|
|
37
|
+
* config:
|
|
38
|
+
* namingConvention: keep
|
|
39
|
+
* ```
|
|
40
|
+
*
|
|
41
|
+
* ## Remove Underscores
|
|
42
|
+
* ```yaml
|
|
43
|
+
* config:
|
|
44
|
+
* namingConvention:
|
|
45
|
+
* typeNames: change-case-all#pascalCase
|
|
46
|
+
* transformUnderscore: true
|
|
47
|
+
* ```
|
|
48
|
+
*/
|
|
49
|
+
namingConvention?: NamingConvention;
|
|
50
|
+
/**
|
|
51
|
+
* @default ""
|
|
52
|
+
* @description Adds prefix to the name
|
|
53
|
+
*
|
|
54
|
+
* @exampleMarkdown
|
|
55
|
+
* ```yaml
|
|
56
|
+
* documents: src/api/user-service/queries.graphql
|
|
57
|
+
* generates:
|
|
58
|
+
* src/api/user-service/queries.ts:
|
|
59
|
+
* plugins:
|
|
60
|
+
* - typescript-document-nodes
|
|
61
|
+
* config:
|
|
62
|
+
* namePrefix: 'gql'
|
|
63
|
+
* ```
|
|
64
|
+
*/
|
|
65
|
+
namePrefix?: string;
|
|
66
|
+
/**
|
|
67
|
+
* @default ""
|
|
68
|
+
* @description Adds suffix to the name
|
|
69
|
+
*
|
|
70
|
+
* @exampleMarkdown
|
|
71
|
+
* ```yaml
|
|
72
|
+
* documents: src/api/user-service/queries.graphql
|
|
73
|
+
* generates:
|
|
74
|
+
* src/api/user-service/queries.ts:
|
|
75
|
+
* plugins:
|
|
76
|
+
* - typescript-document-nodes
|
|
77
|
+
* config:
|
|
78
|
+
* nameSuffix: 'Query'
|
|
79
|
+
* ```
|
|
80
|
+
*/
|
|
81
|
+
nameSuffix?: string;
|
|
82
|
+
/**
|
|
83
|
+
* @default ""
|
|
84
|
+
* @description Adds prefix to the fragment variable
|
|
85
|
+
*/
|
|
86
|
+
fragmentPrefix?: string;
|
|
87
|
+
/**
|
|
88
|
+
* @default ""
|
|
89
|
+
* @description Adds suffix to the fragment variable
|
|
90
|
+
*/
|
|
91
|
+
fragmentSuffix?: string;
|
|
92
|
+
}
|
|
93
|
+
export declare const plugin: PluginFunction<TypeScriptDocumentNodesRawPluginConfig>;
|
|
94
|
+
export declare const validate: PluginValidateFn<any>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { TypeScriptDocumentNodesRawPluginConfig } from './index.cjs';
|
|
2
|
+
import { Types } from '@graphql-codegen/plugin-helpers';
|
|
3
|
+
import { LoadedFragment, ClientSideBaseVisitor, NamingConvention, ClientSideBasePluginConfig } from '@graphql-codegen/visitor-plugin-common';
|
|
4
|
+
import { GraphQLSchema } from 'graphql';
|
|
5
|
+
export interface TypeScriptDocumentNodesPluginConfig extends ClientSideBasePluginConfig {
|
|
6
|
+
namingConvention: NamingConvention;
|
|
7
|
+
transformUnderscore: boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare class TypeScriptDocumentNodesVisitor extends ClientSideBaseVisitor<TypeScriptDocumentNodesRawPluginConfig, TypeScriptDocumentNodesPluginConfig> {
|
|
10
|
+
constructor(schema: GraphQLSchema, fragments: LoadedFragment[], rawConfig: TypeScriptDocumentNodesRawPluginConfig, documents: Types.DocumentFile[]);
|
|
11
|
+
}
|