-
Notifications
You must be signed in to change notification settings - Fork 1.3k
/
client-side-base-visitor.ts
691 lines (609 loc) · 23.7 KB
/
client-side-base-visitor.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
import { basename, extname } from 'path';
import { oldVisit, Types } from '@graphql-codegen/plugin-helpers';
import { optimizeDocumentNode } from '@graphql-tools/optimize';
import autoBind from 'auto-bind';
import { pascalCase } from 'change-case-all';
import { DepGraph } from 'dependency-graph';
import {
FragmentDefinitionNode,
FragmentSpreadNode,
GraphQLSchema,
Kind,
OperationDefinitionNode,
print,
} from 'graphql';
import gqlTag from 'graphql-tag';
import { BaseVisitor, ParsedConfig, RawConfig } from './base-visitor.js';
import { generateFragmentImportStatement } from './imports.js';
import { LoadedFragment, ParsedImport } from './types.js';
import { buildScalarsFromConfig, getConfigValue } from './utils.js';
gqlTag.enableExperimentalFragmentVariables();
export enum DocumentMode {
graphQLTag = 'graphQLTag',
documentNode = 'documentNode',
documentNodeImportFragments = 'documentNodeImportFragments',
external = 'external',
string = 'string',
}
const EXTENSIONS_TO_REMOVE = ['.ts', '.tsx', '.js', '.jsx'];
export interface RawClientSideBasePluginConfig extends RawConfig {
/**
* @description Deprecated. Changes the documentMode to `documentNode`.
* @default false
*/
noGraphQLTag?: boolean;
/**
* @default graphql-tag#gql
* @description Customize from which module will `gql` be imported from.
* This is useful if you want to use modules other than `graphql-tag`, e.g. `graphql.macro`.
*
* @exampleMarkdown
* ## graphql.macro
*
* ```ts filename="codegen.ts"
* import type { CodegenConfig } from '@graphql-codegen/cli';
*
* const config: CodegenConfig = {
* // ...
* generates: {
* 'path/to/file': {
* // plugins...
* config: {
* gqlImport: 'graphql.macro#gql'
* },
* },
* },
* };
* export default config;
* ```
*
* ## Gatsby
*
* ```ts filename="codegen.ts"
* import type { CodegenConfig } from '@graphql-codegen/cli';
*
* const config: CodegenConfig = {
* // ...
* generates: {
* 'path/to/file': {
* // plugins...
* config: {
* gqlImport: 'gatsby#graphql'
* },
* },
* },
* };
* export default config;
* ```
*/
gqlImport?: string;
/**
* @default graphql#DocumentNode
* @description Customize from which module will `DocumentNode` be imported from.
* This is useful if you want to use modules other than `graphql`, e.g. `@graphql-typed-document-node`.
*/
documentNodeImport?: string;
/**
* @default false
* @description Set this configuration to `true` if you wish to tell codegen to generate code with no `export` identifier.
*/
noExport?: boolean;
/**
* @default false
* @description Set this configuration to `true` if you wish to make sure to remove duplicate operation name suffix.
*/
dedupeOperationSuffix?: boolean;
/**
* @default false
* @description Set this configuration to `true` if you wish to disable auto add suffix of operation name, like `Query`, `Mutation`, `Subscription`, `Fragment`.
*/
omitOperationSuffix?: boolean;
/**
* @default ""
* @description Adds a suffix to generated operation result type names
*/
operationResultSuffix?: string;
/**
* @default ""
* @description Changes the GraphQL operations variables prefix.
*/
documentVariablePrefix?: string;
/**
* @default Document
* @description Changes the GraphQL operations variables suffix.
*/
documentVariableSuffix?: string;
/**
* @default ""
* @description Changes the GraphQL fragments variables prefix.
*/
fragmentVariablePrefix?: string;
/**
* @default FragmentDoc
* @description Changes the GraphQL fragments variables suffix.
*/
fragmentVariableSuffix?: string;
/**
* @default graphQLTag
* @description Declares how DocumentNode are created:
*
* - `graphQLTag`: `graphql-tag` or other modules (check `gqlImport`) will be used to generate document nodes. If this is used, document nodes are generated on client side i.e. the module used to generate this will be shipped to the client
* - `documentNode`: document nodes will be generated as objects when we generate the templates.
* - `documentNodeImportFragments`: Similar to documentNode except it imports external fragments instead of embedding them.
* - `external`: document nodes are imported from an external file. To be used with `importDocumentNodeExternallyFrom`
*
* Note that some plugins (like `typescript-graphql-request`) also supports `string` for this parameter.
*
*/
documentMode?: DocumentMode;
/**
* @default true
* @description If you are using `documentNode: documentMode | documentNodeImportFragments`, you can set this to `true` to apply document optimizations for your GraphQL document.
* This will remove all "loc" and "description" fields from the compiled document, and will remove all empty arrays (such as `directives`, `arguments` and `variableDefinitions`).
*/
optimizeDocumentNode?: boolean;
/**
* @default ""
* @description This config is used internally by presets, but you can use it manually to tell codegen to prefix all base types that it's using.
* This is useful if you wish to generate base types from `typescript-operations` plugin into a different file, and import it from there.
*/
importOperationTypesFrom?: string;
/**
* @default ""
* @description This config should be used if `documentMode` is `external`. This has 2 usage:
*
* - any string: This would be the path to import document nodes from. This can be used if we want to manually create the document nodes e.g. Use `graphql-tag` in a separate file and export the generated document
* - 'near-operation-file': This is a special mode that is intended to be used with `near-operation-file` preset to import document nodes from those files. If these files are `.graphql` files, we make use of webpack loader.
*
* @exampleMarkdown
* ```ts filename="codegen.ts"
* import type { CodegenConfig } from '@graphql-codegen/cli';
*
* const config: CodegenConfig = {
* // ...
* generates: {
* 'path/to/file': {
* // plugins...
* config: {
* documentMode: 'external',
* importDocumentNodeExternallyFrom: 'path/to/document-node-file',
* },
* },
* },
* };
* export default config;
* ```
*
* ```ts filename="codegen.ts"
* import type { CodegenConfig } from '@graphql-codegen/cli';
*
* const config: CodegenConfig = {
* // ...
* generates: {
* 'path/to/file': {
* // plugins...
* config: {
* documentMode: 'external',
* importDocumentNodeExternallyFrom: 'near-operation-file',
* },
* },
* },
* };
* export default config;
* ```
*
*/
importDocumentNodeExternallyFrom?: string;
/**
* @default false
* @description This config adds PURE magic comment to the static variables to enforce treeshaking for your bundler.
*/
pureMagicComment?: boolean;
/**
* @default false
* @description If set to true, it will enable support for parsing variables on fragments.
*/
experimentalFragmentVariables?: boolean;
}
export interface ClientSideBasePluginConfig extends ParsedConfig {
gqlImport: string;
documentNodeImport: string;
operationResultSuffix: string;
dedupeOperationSuffix: boolean;
omitOperationSuffix: boolean;
noExport: boolean;
documentVariablePrefix: string;
documentVariableSuffix: string;
fragmentVariablePrefix: string;
fragmentVariableSuffix: string;
documentMode?: DocumentMode;
importDocumentNodeExternallyFrom?: 'near-operation-file' | string;
importOperationTypesFrom?: string;
globalNamespace?: boolean;
pureMagicComment?: boolean;
optimizeDocumentNode: boolean;
experimentalFragmentVariables?: boolean;
}
export class ClientSideBaseVisitor<
TRawConfig extends RawClientSideBasePluginConfig = RawClientSideBasePluginConfig,
TPluginConfig extends ClientSideBasePluginConfig = ClientSideBasePluginConfig
> extends BaseVisitor<TRawConfig, TPluginConfig> {
protected _collectedOperations: OperationDefinitionNode[] = [];
protected _documents: Types.DocumentFile[] = [];
protected _additionalImports: string[] = [];
protected _imports = new Set<string>();
constructor(
protected _schema: GraphQLSchema,
protected _fragments: LoadedFragment[],
rawConfig: TRawConfig,
additionalConfig: Partial<TPluginConfig>,
documents?: Types.DocumentFile[]
) {
super(rawConfig, {
scalars: buildScalarsFromConfig(_schema, rawConfig),
dedupeOperationSuffix: getConfigValue(rawConfig.dedupeOperationSuffix, false),
optimizeDocumentNode: getConfigValue(rawConfig.optimizeDocumentNode, true),
omitOperationSuffix: getConfigValue(rawConfig.omitOperationSuffix, false),
gqlImport: rawConfig.gqlImport || null,
documentNodeImport: rawConfig.documentNodeImport || null,
noExport: Boolean(rawConfig.noExport),
importOperationTypesFrom: getConfigValue(rawConfig.importOperationTypesFrom, null),
operationResultSuffix: getConfigValue(rawConfig.operationResultSuffix, ''),
documentVariablePrefix: getConfigValue(rawConfig.documentVariablePrefix, ''),
documentVariableSuffix: getConfigValue(rawConfig.documentVariableSuffix, 'Document'),
fragmentVariablePrefix: getConfigValue(rawConfig.fragmentVariablePrefix, ''),
fragmentVariableSuffix: getConfigValue(rawConfig.fragmentVariableSuffix, 'FragmentDoc'),
documentMode: ((rawConfig: RawClientSideBasePluginConfig) => {
if (typeof rawConfig.noGraphQLTag === 'boolean') {
return rawConfig.noGraphQLTag ? DocumentMode.documentNode : DocumentMode.graphQLTag;
}
return getConfigValue(rawConfig.documentMode, DocumentMode.graphQLTag);
})(rawConfig),
importDocumentNodeExternallyFrom: getConfigValue(rawConfig.importDocumentNodeExternallyFrom, ''),
pureMagicComment: getConfigValue(rawConfig.pureMagicComment, false),
experimentalFragmentVariables: getConfigValue(rawConfig.experimentalFragmentVariables, false),
...additionalConfig,
} as any);
this._documents = documents;
autoBind(this);
}
protected _extractFragments(
document: FragmentDefinitionNode | OperationDefinitionNode,
withNested = false
): string[] {
if (!document) {
return [];
}
const names: Set<string> = new Set();
oldVisit(document, {
enter: {
FragmentSpread: (node: FragmentSpreadNode) => {
names.add(node.name.value);
if (withNested) {
const foundFragment = this._fragments.find(f => f.name === node.name.value);
if (foundFragment) {
const childItems = this._extractFragments(foundFragment.node, true);
if (childItems && childItems.length > 0) {
for (const item of childItems) {
names.add(item);
}
}
}
}
},
},
});
return Array.from(names);
}
protected _transformFragments(document: FragmentDefinitionNode | OperationDefinitionNode): string[] {
const includeNestedFragments =
this.config.documentMode === DocumentMode.documentNode ||
(this.config.dedupeFragments && document.kind === 'OperationDefinition');
return this._extractFragments(document, includeNestedFragments).map(document =>
this.getFragmentVariableName(document)
);
}
protected _includeFragments(fragments: string[], nodeKind: 'FragmentDefinition' | 'OperationDefinition'): string {
if (fragments && fragments.length > 0) {
if (this.config.documentMode === DocumentMode.documentNode) {
return this._fragments
.filter(f => fragments.includes(this.getFragmentVariableName(f.name)))
.map(fragment => print(fragment.node))
.join('\n');
}
if (this.config.documentMode === DocumentMode.documentNodeImportFragments) {
return '';
}
if (this.config.dedupeFragments && nodeKind !== 'OperationDefinition') {
return '';
}
return String(fragments.map(name => '${' + name + '}').join('\n'));
}
return '';
}
protected _prepareDocument(documentStr: string): string {
return documentStr;
}
protected _gql(node: FragmentDefinitionNode | OperationDefinitionNode): string {
const fragments = this._transformFragments(node);
const doc = this._prepareDocument(`
${print(node).split('\\').join('\\\\') /* Re-escape escaped values in GraphQL syntax */}
${this._includeFragments(fragments, node.kind)}`);
if (this.config.documentMode === DocumentMode.documentNode) {
let gqlObj = gqlTag([doc]);
if (this.config.optimizeDocumentNode) {
gqlObj = optimizeDocumentNode(gqlObj);
}
return JSON.stringify(gqlObj);
}
if (this.config.documentMode === DocumentMode.documentNodeImportFragments) {
let gqlObj = gqlTag([doc]);
if (this.config.optimizeDocumentNode) {
gqlObj = optimizeDocumentNode(gqlObj);
}
if (fragments.length > 0 && (!this.config.dedupeFragments || node.kind === 'OperationDefinition')) {
const definitions = [
...gqlObj.definitions.map(t => JSON.stringify(t)),
...fragments.map(name => `...${name}.definitions`),
].join();
return `{"kind":"${Kind.DOCUMENT}","definitions":[${definitions}]}`;
}
return JSON.stringify(gqlObj);
}
if (this.config.documentMode === DocumentMode.string) {
return '`' + doc + '`';
}
const gqlImport = this._parseImport(this.config.gqlImport || 'graphql-tag');
return (gqlImport.propName || 'gql') + '`' + doc + '`';
}
protected _generateFragment(fragmentDocument: FragmentDefinitionNode): string | void {
const name = this.getFragmentVariableName(fragmentDocument);
const fragmentTypeSuffix = this.getFragmentSuffix(fragmentDocument);
return `export const ${name} =${this.config.pureMagicComment ? ' /*#__PURE__*/' : ''} ${this._gql(
fragmentDocument
)}${this.getDocumentNodeSignature(
this.convertName(fragmentDocument.name.value, {
useTypesPrefix: true,
suffix: fragmentTypeSuffix,
}),
this.config.experimentalFragmentVariables
? this.convertName(fragmentDocument.name.value, {
suffix: fragmentTypeSuffix + 'Variables',
})
: 'unknown',
fragmentDocument
)};`;
}
private get fragmentsGraph(): DepGraph<LoadedFragment> {
const graph = new DepGraph<LoadedFragment>({ circular: true });
for (const fragment of this._fragments) {
if (graph.hasNode(fragment.name)) {
const cachedAsString = print(graph.getNodeData(fragment.name).node);
const asString = print(fragment.node);
if (cachedAsString !== asString) {
throw new Error(`Duplicated fragment called '${fragment.name}'!`);
}
}
graph.addNode(fragment.name, fragment);
}
this._fragments.forEach(fragment => {
const depends = this._extractFragments(fragment.node);
if (depends && depends.length > 0) {
depends.forEach(name => {
graph.addDependency(fragment.name, name);
});
}
});
return graph;
}
public get fragments(): string {
if (this._fragments.length === 0 || this.config.documentMode === DocumentMode.external) {
return '';
}
const graph = this.fragmentsGraph;
const orderedDeps = graph.overallOrder();
const localFragments = orderedDeps
.filter(name => !graph.getNodeData(name).isExternal)
.map(name => this._generateFragment(graph.getNodeData(name).node));
return localFragments.join('\n');
}
protected _parseImport(importStr: string): ParsedImport {
// This is a special case when we want to ignore importing, and just use `gql` provided from somewhere else
// Plugins that uses that will need to ensure to add import/declaration for the gql identifier
if (importStr === 'gql') {
return {
moduleName: null,
propName: 'gql',
};
}
// This is a special use case, when we don't want this plugin to manage the import statement
// of the gql tag. In this case, we provide something like `Namespace.gql` and it will be used instead.
if (importStr.includes('.gql')) {
return {
moduleName: null,
propName: importStr,
};
}
const [moduleName, propName] = importStr.split('#');
return {
moduleName,
propName,
};
}
protected _generateImport(
{ moduleName, propName }: ParsedImport,
varName: string,
isTypeImport: boolean
): string | null {
const typeImport = isTypeImport && this.config.useTypeImports ? 'import type' : 'import';
const propAlias = propName === varName ? '' : ` as ${varName}`;
if (moduleName) {
return `${typeImport} ${propName ? `{ ${propName}${propAlias} }` : varName} from '${moduleName}';`;
}
return null;
}
private clearExtension(path: string): string {
const extension = extname(path);
if (EXTENSIONS_TO_REMOVE.includes(extension)) {
return path.replace(/\.[^/.]+$/, '');
}
return path;
}
public getImports(options: { excludeFragments?: boolean } = {}): string[] {
(this._additionalImports || []).forEach(i => this._imports.add(i));
switch (this.config.documentMode) {
case DocumentMode.documentNode:
case DocumentMode.documentNodeImportFragments: {
const documentNodeImport = this._parseImport(this.config.documentNodeImport || 'graphql#DocumentNode');
const tagImport = this._generateImport(documentNodeImport, 'DocumentNode', true);
if (tagImport) {
this._imports.add(tagImport);
}
break;
}
case DocumentMode.graphQLTag: {
const gqlImport = this._parseImport(this.config.gqlImport || 'graphql-tag');
const tagImport = this._generateImport(gqlImport, 'gql', false);
if (tagImport) {
this._imports.add(tagImport);
}
break;
}
case DocumentMode.external: {
if (this._collectedOperations.length > 0) {
if (this.config.importDocumentNodeExternallyFrom === 'near-operation-file' && this._documents.length === 1) {
let documentPath = `./${this.clearExtension(basename(this._documents[0].location))}`;
if (!this.config.emitLegacyCommonJSImports) {
documentPath += '.js';
}
this._imports.add(`import * as Operations from '${documentPath}';`);
} else {
if (!this.config.importDocumentNodeExternallyFrom) {
// eslint-disable-next-line no-console
console.warn('importDocumentNodeExternallyFrom must be provided if documentMode=external');
}
this._imports.add(
`import * as Operations from '${this.clearExtension(this.config.importDocumentNodeExternallyFrom)}';`
);
}
}
break;
}
default:
break;
}
if (!options.excludeFragments && !this.config.globalNamespace) {
const { documentMode, fragmentImports } = this.config;
if (
documentMode === DocumentMode.graphQLTag ||
documentMode === DocumentMode.string ||
documentMode === DocumentMode.documentNodeImportFragments
) {
// keep track of what imports we've already generated so we don't try
// to import the same identifier twice
const alreadyImported = new Map<string, Set<string>>();
const deduplicatedImports = fragmentImports
.map(fragmentImport => {
const { path, identifiers } = fragmentImport.importSource;
if (!alreadyImported.has(path)) {
alreadyImported.set(path, new Set<string>());
}
const alreadyImportedForPath = alreadyImported.get(path);
const newIdentifiers = identifiers.filter(identifier => !alreadyImportedForPath.has(identifier.name));
newIdentifiers.forEach(newIdentifier => alreadyImportedForPath.add(newIdentifier.name));
// filter the set of identifiers in this fragment import to only
// the ones we haven't already imported from this path
return {
...fragmentImport,
importSource: {
...fragmentImport.importSource,
identifiers: newIdentifiers,
},
emitLegacyCommonJSImports: this.config.emitLegacyCommonJSImports,
};
})
// remove any imports that now have no identifiers in them
.filter(fragmentImport => fragmentImport.importSource.identifiers.length > 0);
deduplicatedImports.forEach(fragmentImport => {
if (fragmentImport.outputPath !== fragmentImport.importSource.path) {
this._imports.add(generateFragmentImportStatement(fragmentImport, 'document'));
}
});
}
}
return Array.from(this._imports);
}
protected buildOperation(
_node: OperationDefinitionNode,
_documentVariableName: string,
_operationType: string,
_operationResultType: string,
_operationVariablesTypes: string,
_hasRequiredVariables: boolean
): string {
return null;
}
protected getDocumentNodeSignature(
_resultType: string,
_variablesTypes: string,
_node: FragmentDefinitionNode | OperationDefinitionNode
): string {
if (
this.config.documentMode === DocumentMode.documentNode ||
this.config.documentMode === DocumentMode.documentNodeImportFragments
) {
return ` as unknown as DocumentNode`;
}
return '';
}
/**
* Checks if the specific operation has variables that are non-null (required), and also doesn't have default.
* This is useful for deciding of `variables` should be optional or not.
* @param node
*/
protected checkVariablesRequirements(node: OperationDefinitionNode): boolean {
const variables = node.variableDefinitions || [];
if (variables.length === 0) {
return false;
}
return variables.some(variableDef => variableDef.type.kind === Kind.NON_NULL_TYPE && !variableDef.defaultValue);
}
public getOperationVariableName(node: OperationDefinitionNode) {
return this.convertName(node, {
suffix: this.config.documentVariableSuffix,
prefix: this.config.documentVariablePrefix,
useTypesPrefix: false,
});
}
public OperationDefinition(node: OperationDefinitionNode): string {
this._collectedOperations.push(node);
const documentVariableName = this.getOperationVariableName(node);
const operationType: string = pascalCase(node.operation);
const operationTypeSuffix: string = this.getOperationSuffix(node, operationType);
const operationResultType: string = this.convertName(node, {
suffix: operationTypeSuffix + this._parsedConfig.operationResultSuffix,
});
const operationVariablesTypes: string = this.convertName(node, {
suffix: operationTypeSuffix + 'Variables',
});
let documentString = '';
if (
this.config.documentMode !== DocumentMode.external &&
documentVariableName !== '' // only generate exports for named queries
) {
documentString = `${this.config.noExport ? '' : 'export'} const ${documentVariableName} =${
this.config.pureMagicComment ? ' /*#__PURE__*/' : ''
} ${this._gql(node)}${this.getDocumentNodeSignature(operationResultType, operationVariablesTypes, node)};`;
}
const hasRequiredVariables = this.checkVariablesRequirements(node);
const additional = this.buildOperation(
node,
documentVariableName,
operationType,
operationResultType,
operationVariablesTypes,
hasRequiredVariables
);
return [documentString, additional].filter(a => a).join('\n');
}
}