@graphql-codegen/c-sharp 4.2.14 → 4.2.16-alpha-2cc8b095b.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/index.js DELETED
@@ -1,649 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- const pluginHelpers = require('@graphql-codegen/plugin-helpers');
6
- const visitorPluginCommon = require('@graphql-codegen/visitor-plugin-common');
7
- const graphql = require('graphql');
8
- const changeCaseAll = require('change-case-all');
9
-
10
- const C_SHARP_SCALARS = {
11
- ID: 'string',
12
- String: 'string',
13
- Boolean: 'bool',
14
- Int: 'int',
15
- Float: 'double',
16
- Date: 'DateTime',
17
- };
18
- const csharpValueTypes = [
19
- 'bool',
20
- 'byte',
21
- 'sbyte',
22
- 'char',
23
- 'decimal',
24
- 'double',
25
- 'float',
26
- 'int',
27
- 'uint',
28
- 'long',
29
- 'ulong',
30
- 'short',
31
- 'ushort',
32
- 'DateTime',
33
- ];
34
-
35
- // This file is bundled and inlined.
36
- function transformComment(comment, indentLevel = 0) {
37
- if (!comment) {
38
- return '';
39
- }
40
- if (isStringValueNode(comment)) {
41
- comment = comment.value;
42
- }
43
- comment = comment.trimStart().split('*/').join('*\\/');
44
- let lines = comment.split('\n');
45
- lines = ['/// <summary>', ...lines.map(line => `/// ${line}`), '/// </summary>'];
46
- return lines
47
- .map(line => visitorPluginCommon.indent(line, indentLevel))
48
- .concat('')
49
- .join('\n');
50
- }
51
- function isStringValueNode(node) {
52
- return node && typeof node === 'object' && node.kind === graphql.Kind.STRING;
53
- }
54
- function isValueType(type) {
55
- // Limitation: only checks the list of known built in value types
56
- // Eg .NET types and struct types won't be detected correctly
57
- return csharpValueTypes.includes(type);
58
- }
59
- function getListTypeField(typeNode) {
60
- if (typeNode.kind === graphql.Kind.LIST_TYPE) {
61
- return {
62
- required: false,
63
- type: getListTypeField(typeNode.type),
64
- };
65
- }
66
- if (typeNode.kind === graphql.Kind.NON_NULL_TYPE && typeNode.type.kind === graphql.Kind.LIST_TYPE) {
67
- return Object.assign(getListTypeField(typeNode.type), {
68
- required: true,
69
- });
70
- }
71
- if (typeNode.kind === graphql.Kind.NON_NULL_TYPE) {
72
- return getListTypeField(typeNode.type);
73
- }
74
- return undefined;
75
- }
76
- function getListInnerTypeNode(typeNode) {
77
- if (typeNode.kind === graphql.Kind.LIST_TYPE) {
78
- return getListInnerTypeNode(typeNode.type);
79
- }
80
- if (typeNode.kind === graphql.Kind.NON_NULL_TYPE && typeNode.type.kind === graphql.Kind.LIST_TYPE) {
81
- return getListInnerTypeNode(typeNode.type);
82
- }
83
- return typeNode;
84
- }
85
- function wrapFieldType(fieldType, listTypeField, listType = 'IEnumerable') {
86
- if (listTypeField) {
87
- const innerType = wrapFieldType(fieldType, listTypeField.type, listType);
88
- return `${listType}<${innerType}>`;
89
- }
90
- return fieldType.innerTypeName;
91
- }
92
-
93
- // This file is bundled and inlined.
94
- class CSharpDeclarationBlock {
95
- constructor() {
96
- this._name = null;
97
- this._extendStr = [];
98
- this._implementsStr = [];
99
- this._kind = null;
100
- this._access = 'public';
101
- this._final = false;
102
- this._static = false;
103
- this._block = null;
104
- this._comment = null;
105
- this._nestedClasses = [];
106
- }
107
- nestedClass(nstCls) {
108
- this._nestedClasses.push(nstCls);
109
- return this;
110
- }
111
- access(access) {
112
- this._access = access;
113
- return this;
114
- }
115
- asKind(kind) {
116
- this._kind = kind;
117
- return this;
118
- }
119
- final() {
120
- this._final = true;
121
- return this;
122
- }
123
- static() {
124
- this._static = true;
125
- return this;
126
- }
127
- withComment(comment) {
128
- if (comment) {
129
- this._comment = transformComment(comment, 1);
130
- }
131
- return this;
132
- }
133
- withBlock(block) {
134
- this._block = block;
135
- return this;
136
- }
137
- extends(extendStr) {
138
- this._extendStr = extendStr;
139
- return this;
140
- }
141
- implements(implementsStr) {
142
- this._implementsStr = implementsStr;
143
- return this;
144
- }
145
- withName(name) {
146
- this._name = typeof name === 'object' ? name.value : name;
147
- return this;
148
- }
149
- get string() {
150
- let result = '';
151
- if (this._kind) {
152
- let name = '';
153
- if (this._name) {
154
- name = this._name;
155
- }
156
- if (this._kind === 'namespace') {
157
- result += `${this._kind} ${name} `;
158
- }
159
- else {
160
- let extendStr = '';
161
- let implementsStr = '';
162
- const final = this._final ? ' final' : '';
163
- const isStatic = this._static ? ' static' : '';
164
- if (this._extendStr.length > 0) {
165
- extendStr = ` : ${this._extendStr.join(', ')}`;
166
- }
167
- if (this._implementsStr.length > 0) {
168
- implementsStr = ` : ${this._implementsStr.join(', ')}`;
169
- }
170
- result += `${this._access}${isStatic}${final} ${this._kind} ${name}${extendStr}${implementsStr} `;
171
- }
172
- }
173
- const nestedClasses = this._nestedClasses.length
174
- ? this._nestedClasses.map(c => visitorPluginCommon.indentMultiline(c.string)).join('\n\n')
175
- : null;
176
- const before = '{';
177
- const after = '}';
178
- const block = [before, nestedClasses, this._block, after].filter(f => f).join('\n');
179
- result += block;
180
- return (this._comment ? this._comment : '') + result + '\n';
181
- }
182
- }
183
-
184
- class CSharpFieldType {
185
- constructor(fieldType) {
186
- Object.assign(this, fieldType);
187
- }
188
- get innerTypeName() {
189
- const nullable = this.baseType.valueType && !this.baseType.required ? '?' : '';
190
- return `${this.baseType.type}${nullable}`;
191
- }
192
- get isOuterTypeRequired() {
193
- return this.listType ? this.listType.required : this.baseType.required;
194
- }
195
- }
196
-
197
- /**
198
- * C# keywords
199
- * https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/
200
- */
201
- const csharpKeywords = new Set([
202
- 'abstract',
203
- 'as',
204
- 'base',
205
- 'bool',
206
- 'break',
207
- 'byte',
208
- 'case',
209
- 'catch',
210
- 'char',
211
- 'checked',
212
- 'class',
213
- 'const',
214
- 'continue',
215
- 'decimal',
216
- 'default',
217
- 'delegate',
218
- 'do',
219
- 'double',
220
- 'else',
221
- 'enum',
222
- 'event',
223
- 'explicit',
224
- 'extern',
225
- 'false',
226
- 'finally',
227
- 'fixed',
228
- 'float',
229
- 'for',
230
- 'foreach',
231
- 'goto',
232
- 'if',
233
- 'implicit',
234
- 'in',
235
- 'int',
236
- 'interface',
237
- 'internal',
238
- 'is',
239
- 'lock',
240
- 'long',
241
- 'namespace',
242
- 'new',
243
- 'null',
244
- 'object',
245
- 'operator',
246
- 'out',
247
- 'override',
248
- 'params',
249
- 'private',
250
- 'protected',
251
- 'public',
252
- 'readonly',
253
- 'record',
254
- 'ref',
255
- 'return',
256
- 'sbyte',
257
- 'sealed',
258
- 'short',
259
- 'sizeof',
260
- 'stackalloc',
261
- 'static',
262
- 'string',
263
- 'struct',
264
- 'switch',
265
- 'this',
266
- 'throw',
267
- 'true',
268
- 'try',
269
- 'typeof',
270
- 'uint',
271
- 'ulong',
272
- 'unchecked',
273
- 'unsafe',
274
- 'ushort',
275
- 'using',
276
- 'virtual',
277
- 'void',
278
- 'volatile',
279
- 'while',
280
- ]);
281
- /**
282
- * Checks name against list of keywords. If it is, will prefix value with @
283
- *
284
- * Note:
285
- * This class should first invoke the convertName from base-visitor to convert the string or node
286
- * value according the naming configuration, eg upper or lower case. Then resulting string checked
287
- * against the list or keywords.
288
- * However the generated C# code is not yet able to handle fields that are in a different case so
289
- * the invocation of convertName is omitted purposely.
290
- */
291
- function convertSafeName(node) {
292
- const name = typeof node === 'string' ? node : node.value;
293
- return csharpKeywords.has(name) ? `@${name}` : name;
294
- }
295
-
296
- function unsupportedSource(attributesSource) {
297
- throw new Error(`Unsupported JSON attributes source: ${attributesSource}`);
298
- }
299
- class JsonAttributesSourceConfiguration {
300
- constructor(namespace, propertyAttribute, requiredAttribute) {
301
- this.namespace = namespace;
302
- this.propertyAttribute = propertyAttribute;
303
- this.requiredAttribute = requiredAttribute;
304
- }
305
- }
306
- const newtonsoftConfiguration = new JsonAttributesSourceConfiguration('Newtonsoft.Json', 'JsonProperty', 'JsonRequired');
307
- // System.Text.Json does not have support of `JsonRequired` alternative (as for .NET 5)
308
- const systemTextJsonConfiguration = new JsonAttributesSourceConfiguration('System.Text.Json.Serialization', 'JsonPropertyName', null);
309
- function getJsonAttributeSourceConfiguration(attributesSource) {
310
- switch (attributesSource) {
311
- case 'Newtonsoft.Json':
312
- return newtonsoftConfiguration;
313
- case 'System.Text.Json':
314
- return systemTextJsonConfiguration;
315
- }
316
- unsupportedSource(attributesSource);
317
- }
318
-
319
- class CSharpResolversVisitor extends visitorPluginCommon.BaseVisitor {
320
- constructor(rawConfig, _schema) {
321
- var _a;
322
- super(rawConfig, {
323
- enumValues: rawConfig.enumValues || {},
324
- listType: rawConfig.listType || 'List',
325
- namespaceName: rawConfig.namespaceName || 'GraphQLCodeGen',
326
- className: rawConfig.className || 'Types',
327
- emitRecords: rawConfig.emitRecords || false,
328
- emitJsonAttributes: (_a = rawConfig.emitJsonAttributes) !== null && _a !== void 0 ? _a : true,
329
- jsonAttributesSource: rawConfig.jsonAttributesSource || 'Newtonsoft.Json',
330
- scalars: visitorPluginCommon.buildScalarsFromConfig(_schema, rawConfig, C_SHARP_SCALARS),
331
- });
332
- this._schema = _schema;
333
- if (this._parsedConfig.emitJsonAttributes) {
334
- this.jsonAttributesConfiguration = getJsonAttributeSourceConfiguration(this._parsedConfig.jsonAttributesSource);
335
- }
336
- }
337
- getImports() {
338
- const allImports = ['System', 'System.Collections.Generic', 'System.ComponentModel.DataAnnotations'];
339
- if (this._parsedConfig.emitJsonAttributes) {
340
- const jsonAttributesNamespace = this.jsonAttributesConfiguration.namespace;
341
- allImports.push(jsonAttributesNamespace);
342
- }
343
- return allImports.map(i => `using ${i};`).join('\n') + '\n';
344
- }
345
- wrapWithNamespace(content) {
346
- return new CSharpDeclarationBlock()
347
- .asKind('namespace')
348
- .withName(this.config.namespaceName)
349
- .withBlock(visitorPluginCommon.indentMultiline(content)).string;
350
- }
351
- wrapWithClass(content) {
352
- return new CSharpDeclarationBlock()
353
- .access('public')
354
- .asKind('class')
355
- .withName(convertSafeName(this.config.className))
356
- .withBlock(visitorPluginCommon.indentMultiline(content)).string;
357
- }
358
- getEnumValue(enumName, enumOption) {
359
- if (this.config.enumValues[enumName] &&
360
- typeof this.config.enumValues[enumName] === 'object' &&
361
- this.config.enumValues[enumName][enumOption]) {
362
- return this.config.enumValues[enumName][enumOption];
363
- }
364
- return enumOption;
365
- }
366
- EnumValueDefinition(node) {
367
- return (enumName) => {
368
- const enumHeader = this.getFieldHeader(node);
369
- const enumOption = convertSafeName(node.name);
370
- return enumHeader + visitorPluginCommon.indent(this.getEnumValue(enumName, enumOption));
371
- };
372
- }
373
- EnumTypeDefinition(node) {
374
- const enumName = this.convertName(node.name);
375
- const enumValues = node.values.map(enumValue => enumValue(node.name.value)).join(',\n');
376
- const enumBlock = [enumValues].join('\n');
377
- return new CSharpDeclarationBlock()
378
- .access('public')
379
- .asKind('enum')
380
- .withComment(node.description)
381
- .withName(enumName)
382
- .withBlock(enumBlock).string;
383
- }
384
- getFieldHeader(node, fieldType) {
385
- var _a;
386
- const attributes = [];
387
- const commentText = transformComment((_a = node.description) === null || _a === void 0 ? void 0 : _a.value);
388
- const deprecationDirective = node.directives.find(v => { var _a; return ((_a = v.name) === null || _a === void 0 ? void 0 : _a.value) === 'deprecated'; });
389
- if (deprecationDirective) {
390
- const deprecationReason = this.getDeprecationReason(deprecationDirective);
391
- attributes.push(`[Obsolete("${deprecationReason}")]`);
392
- }
393
- if (this._parsedConfig.emitJsonAttributes) {
394
- if (node.kind === graphql.Kind.FIELD_DEFINITION) {
395
- const jsonPropertyAttribute = this.jsonAttributesConfiguration.propertyAttribute;
396
- if (jsonPropertyAttribute != null) {
397
- attributes.push(`[${jsonPropertyAttribute}("${node.name.value}")]`);
398
- }
399
- }
400
- }
401
- if (node.kind === graphql.Kind.INPUT_VALUE_DEFINITION && fieldType.isOuterTypeRequired) {
402
- // Should be always inserted for required fields to use in `GetInputObject()` when JSON attributes are not used
403
- // or there are no JSON attributes in selected attribute source that provides `JsonRequired` alternative
404
- attributes.push('[Required]');
405
- if (this._parsedConfig.emitJsonAttributes) {
406
- const jsonRequiredAttribute = this.jsonAttributesConfiguration.requiredAttribute;
407
- if (jsonRequiredAttribute != null) {
408
- attributes.push(`[${jsonRequiredAttribute}]`);
409
- }
410
- }
411
- }
412
- if (commentText || attributes.length > 0) {
413
- const summary = commentText ? visitorPluginCommon.indentMultiline(commentText.trimRight()) + '\n' : '';
414
- const attributeLines = attributes.length > 0
415
- ? attributes
416
- .map(attr => visitorPluginCommon.indent(attr))
417
- .concat('')
418
- .join('\n')
419
- : '';
420
- return summary + attributeLines;
421
- }
422
- return '';
423
- }
424
- getDeprecationReason(directive) {
425
- if (directive.name.value !== 'deprecated') {
426
- return '';
427
- }
428
- const hasArguments = directive.arguments.length > 0;
429
- let reason = 'Field no longer supported';
430
- if (hasArguments && directive.arguments[0].value.kind === graphql.Kind.STRING) {
431
- reason = directive.arguments[0].value.value;
432
- }
433
- return reason;
434
- }
435
- resolveInputFieldType(typeNode, hasDefaultValue = false) {
436
- const innerType = visitorPluginCommon.getBaseTypeNode(typeNode);
437
- const schemaType = this._schema.getType(innerType.name.value);
438
- const listType = getListTypeField(typeNode);
439
- const required = getListInnerTypeNode(typeNode).kind === graphql.Kind.NON_NULL_TYPE;
440
- let result = null;
441
- if (graphql.isScalarType(schemaType)) {
442
- if (this.scalars[schemaType.name]) {
443
- const baseType = this.scalars[schemaType.name];
444
- result = new CSharpFieldType({
445
- baseType: {
446
- type: baseType,
447
- required,
448
- valueType: isValueType(baseType),
449
- },
450
- listType,
451
- });
452
- }
453
- else {
454
- result = new CSharpFieldType({
455
- baseType: {
456
- type: 'object',
457
- required,
458
- valueType: false,
459
- },
460
- listType,
461
- });
462
- }
463
- }
464
- else if (graphql.isInputObjectType(schemaType)) {
465
- result = new CSharpFieldType({
466
- baseType: {
467
- type: `${this.convertName(schemaType.name)}`,
468
- required,
469
- valueType: false,
470
- },
471
- listType,
472
- });
473
- }
474
- else if (graphql.isEnumType(schemaType)) {
475
- result = new CSharpFieldType({
476
- baseType: {
477
- type: this.convertName(schemaType.name),
478
- required,
479
- valueType: true,
480
- },
481
- listType,
482
- });
483
- }
484
- else {
485
- result = new CSharpFieldType({
486
- baseType: {
487
- type: `${schemaType.name}`,
488
- required,
489
- valueType: false,
490
- },
491
- listType,
492
- });
493
- }
494
- if (hasDefaultValue) {
495
- // Required field is optional when default value specified, see #4273
496
- (result.listType || result.baseType).required = false;
497
- }
498
- return result;
499
- }
500
- buildRecord(name, description, inputValueArray, interfaces) {
501
- const classSummary = transformComment(description === null || description === void 0 ? void 0 : description.value);
502
- const interfaceImpl = interfaces && interfaces.length > 0 ? ` : ${interfaces.map(ntn => ntn.name.value).join(', ')}` : '';
503
- const recordMembers = inputValueArray
504
- .map(arg => {
505
- const fieldType = this.resolveInputFieldType(arg.type);
506
- const fieldHeader = this.getFieldHeader(arg, fieldType);
507
- const fieldName = convertSafeName(changeCaseAll.pascalCase(this.convertName(arg.name)));
508
- const csharpFieldType = wrapFieldType(fieldType, fieldType.listType, this.config.listType);
509
- return fieldHeader + visitorPluginCommon.indent(`public ${csharpFieldType} ${fieldName} { get; init; } = ${fieldName};`);
510
- })
511
- .join('\n\n');
512
- const recordInitializer = inputValueArray
513
- .map(arg => {
514
- const fieldType = this.resolveInputFieldType(arg.type);
515
- const fieldName = convertSafeName(changeCaseAll.pascalCase(this.convertName(arg.name)));
516
- const csharpFieldType = wrapFieldType(fieldType, fieldType.listType, this.config.listType);
517
- return `${csharpFieldType} ${fieldName}`;
518
- })
519
- .join(', ');
520
- return `
521
- #region ${name}
522
- ${classSummary}public record ${convertSafeName(name)}(${recordInitializer})${interfaceImpl} {
523
- #region members
524
- ${recordMembers}
525
- #endregion
526
- }
527
- #endregion`;
528
- }
529
- buildClass(name, description, inputValueArray, interfaces) {
530
- const classSummary = transformComment(description === null || description === void 0 ? void 0 : description.value);
531
- const interfaceImpl = interfaces && interfaces.length > 0 ? ` : ${interfaces.map(ntn => ntn.name.value).join(', ')}` : '';
532
- const classMembers = inputValueArray
533
- .map(arg => {
534
- const fieldType = this.resolveInputFieldType(arg.type);
535
- const fieldHeader = this.getFieldHeader(arg, fieldType);
536
- const fieldName = convertSafeName(arg.name);
537
- const csharpFieldType = wrapFieldType(fieldType, fieldType.listType, this.config.listType);
538
- return fieldHeader + visitorPluginCommon.indent(`public ${csharpFieldType} ${fieldName} { get; set; }`);
539
- })
540
- .join('\n\n');
541
- return `
542
- #region ${name}
543
- ${classSummary}public class ${convertSafeName(name)}${interfaceImpl} {
544
- #region members
545
- ${classMembers}
546
- #endregion
547
- }
548
- #endregion`;
549
- }
550
- buildInterface(name, description, inputValueArray) {
551
- const classSummary = transformComment(description === null || description === void 0 ? void 0 : description.value);
552
- const classMembers = inputValueArray
553
- .map(arg => {
554
- const fieldType = this.resolveInputFieldType(arg.type);
555
- const fieldHeader = this.getFieldHeader(arg, fieldType);
556
- let fieldName;
557
- let getterSetter;
558
- if (this.config.emitRecords) {
559
- // record
560
- fieldName = convertSafeName(changeCaseAll.pascalCase(this.convertName(arg.name)));
561
- getterSetter = '{ get; }';
562
- }
563
- else {
564
- // class
565
- fieldName = convertSafeName(arg.name);
566
- getterSetter = '{ get; set; }';
567
- }
568
- const csharpFieldType = wrapFieldType(fieldType, fieldType.listType, this.config.listType);
569
- return fieldHeader + visitorPluginCommon.indent(`${csharpFieldType} ${fieldName} ${getterSetter}`);
570
- })
571
- .join('\n\n');
572
- return `
573
- ${classSummary}public interface ${convertSafeName(name)} {
574
- ${classMembers}
575
- }`;
576
- }
577
- buildInputTransformer(name, description, inputValueArray) {
578
- const classSummary = transformComment(description === null || description === void 0 ? void 0 : description.value);
579
- const classMembers = inputValueArray
580
- .map(arg => {
581
- const fieldType = this.resolveInputFieldType(arg.type, !!arg.defaultValue);
582
- const fieldHeader = this.getFieldHeader(arg, fieldType);
583
- const fieldName = convertSafeName(arg.name);
584
- const csharpFieldType = wrapFieldType(fieldType, fieldType.listType, this.config.listType);
585
- return fieldHeader + visitorPluginCommon.indent(`public ${csharpFieldType} ${fieldName} { get; set; }`);
586
- })
587
- .join('\n\n');
588
- return `
589
- #region ${name}
590
- ${classSummary}public class ${convertSafeName(name)} {
591
- #region members
592
- ${classMembers}
593
- #endregion
594
-
595
- #region methods
596
- public dynamic GetInputObject()
597
- {
598
- IDictionary<string, object> d = new System.Dynamic.ExpandoObject();
599
-
600
- var properties = GetType().GetProperties(System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Public);
601
- foreach (var propertyInfo in properties)
602
- {
603
- var value = propertyInfo.GetValue(this);
604
- var defaultValue = propertyInfo.PropertyType.IsValueType ? Activator.CreateInstance(propertyInfo.PropertyType) : null;
605
- ${this._parsedConfig.emitJsonAttributes && this.jsonAttributesConfiguration.requiredAttribute != null
606
- ? `
607
- var requiredProp = propertyInfo.GetCustomAttributes(typeof(${this.jsonAttributesConfiguration.requiredAttribute}Attribute), false).Length > 0;
608
- `
609
- : `
610
- var requiredProp = propertyInfo.GetCustomAttributes(typeof(RequiredAttribute), false).Length > 0;
611
- `}
612
- if (requiredProp || value != defaultValue)
613
- {
614
- d[propertyInfo.Name] = value;
615
- }
616
- }
617
- return d;
618
- }
619
- #endregion
620
- }
621
- #endregion`;
622
- }
623
- InputObjectTypeDefinition(node) {
624
- const name = `${this.convertName(node)}`;
625
- return this.buildInputTransformer(name, node.description, node.fields);
626
- }
627
- ObjectTypeDefinition(node) {
628
- if (this.config.emitRecords) {
629
- return this.buildRecord(node.name.value, node.description, node.fields, node.interfaces);
630
- }
631
- return this.buildClass(node.name.value, node.description, node.fields, node.interfaces);
632
- }
633
- InterfaceTypeDefinition(node) {
634
- return this.buildInterface(node.name.value, node.description, node.fields);
635
- }
636
- }
637
-
638
- const plugin = async (schema, documents, config) => {
639
- const visitor = new CSharpResolversVisitor(config, schema);
640
- const astNode = pluginHelpers.getCachedDocumentNodeFromSchema(schema);
641
- const visitorResult = pluginHelpers.oldVisit(astNode, { leave: visitor });
642
- const imports = visitor.getImports();
643
- const blockContent = visitorResult.definitions.filter(d => typeof d === 'string').join('\n');
644
- const wrappedBlockContent = visitor.wrapWithClass(blockContent);
645
- const wrappedContent = visitor.wrapWithNamespace(wrappedBlockContent);
646
- return [imports, wrappedContent].join('\n');
647
- };
648
-
649
- exports.plugin = plugin;