@flock/wirespec 0.8.46 → 0.8.47

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.
@@ -1,1408 +0,0 @@
1
- (function (root, factory) {
2
- if (typeof define === 'function' && define.amd)
3
- define(['exports', './kotlin-kotlin-stdlib-js-ir.js', './clikt-clikt.js', './wirespec-src-compiler-core.js', './wirespec-src-converter-openapi.js', './arrow-arrow-core.js'], factory);
4
- else if (typeof exports === 'object')
5
- factory(module.exports, require('./kotlin-kotlin-stdlib-js-ir.js'), require('./clikt-clikt.js'), require('./wirespec-src-compiler-core.js'), require('./wirespec-src-converter-openapi.js'), require('./arrow-arrow-core.js'));
6
- else {
7
- if (typeof this['kotlin-kotlin-stdlib-js-ir'] === 'undefined') {
8
- throw new Error("Error loading module 'wirespec-src-compiler-cli'. Its dependency 'kotlin-kotlin-stdlib-js-ir' was not found. Please, check whether 'kotlin-kotlin-stdlib-js-ir' is loaded prior to 'wirespec-src-compiler-cli'.");
9
- }
10
- if (typeof this['clikt-clikt'] === 'undefined') {
11
- throw new Error("Error loading module 'wirespec-src-compiler-cli'. Its dependency 'clikt-clikt' was not found. Please, check whether 'clikt-clikt' is loaded prior to 'wirespec-src-compiler-cli'.");
12
- }
13
- if (typeof this['wirespec-src-compiler-core'] === 'undefined') {
14
- throw new Error("Error loading module 'wirespec-src-compiler-cli'. Its dependency 'wirespec-src-compiler-core' was not found. Please, check whether 'wirespec-src-compiler-core' is loaded prior to 'wirespec-src-compiler-cli'.");
15
- }
16
- if (typeof this['wirespec-src-converter-openapi'] === 'undefined') {
17
- throw new Error("Error loading module 'wirespec-src-compiler-cli'. Its dependency 'wirespec-src-converter-openapi' was not found. Please, check whether 'wirespec-src-converter-openapi' is loaded prior to 'wirespec-src-compiler-cli'.");
18
- }
19
- if (typeof this['arrow-arrow-core'] === 'undefined') {
20
- throw new Error("Error loading module 'wirespec-src-compiler-cli'. Its dependency 'arrow-arrow-core' was not found. Please, check whether 'arrow-arrow-core' is loaded prior to 'wirespec-src-compiler-cli'.");
21
- }
22
- root['wirespec-src-compiler-cli'] = factory(typeof this['wirespec-src-compiler-cli'] === 'undefined' ? {} : this['wirespec-src-compiler-cli'], this['kotlin-kotlin-stdlib-js-ir'], this['clikt-clikt'], this['wirespec-src-compiler-core'], this['wirespec-src-converter-openapi'], this['arrow-arrow-core']);
23
- }
24
- }(this, function (_, kotlin_kotlin, kotlin_clikt_clikt, kotlin_community_flock_wirespec_compiler_core, kotlin_community_flock_wirespec_converter_openapi, kotlin_io_arrow_kt_arrow_core) {
25
- 'use strict';
26
- //region block: imports
27
- var imul = Math.imul;
28
- var Unit_getInstance = kotlin_kotlin.$_$.t3;
29
- var subcommands = kotlin_clikt_clikt.$_$.c;
30
- var protoOf = kotlin_kotlin.$_$.q9;
31
- var objectMeta = kotlin_kotlin.$_$.p9;
32
- var VOID = kotlin_kotlin.$_$.ke;
33
- var setMetadataFor = kotlin_kotlin.$_$.r9;
34
- var NoOpCliktCommand = kotlin_clikt_clikt.$_$.b;
35
- var classMeta = kotlin_kotlin.$_$.l8;
36
- var hashCode = kotlin_kotlin.$_$.t8;
37
- var getStringHashCode = kotlin_kotlin.$_$.s8;
38
- var THROW_CCE = kotlin_kotlin.$_$.ld;
39
- var equals = kotlin_kotlin.$_$.o8;
40
- var option = kotlin_clikt_clikt.$_$.h;
41
- var choice = kotlin_clikt_clikt.$_$.j;
42
- var multiple = kotlin_clikt_clikt.$_$.g;
43
- var toSet = kotlin_kotlin.$_$.o7;
44
- var argument = kotlin_clikt_clikt.$_$.d;
45
- var mapCapacity = kotlin_kotlin.$_$.m6;
46
- var coerceAtLeast = kotlin_kotlin.$_$.aa;
47
- var LinkedHashMap_init_$Create$ = kotlin_kotlin.$_$.r;
48
- var choice_0 = kotlin_clikt_clikt.$_$.i;
49
- var listOf = kotlin_kotlin.$_$.k6;
50
- var setOf = kotlin_kotlin.$_$.x6;
51
- var CliktCommand = kotlin_clikt_clikt.$_$.a;
52
- var get_DEFAULT_PACKAGE_NAME = kotlin_community_flock_wirespec_compiler_core.$_$.a;
53
- var default_0 = kotlin_clikt_clikt.$_$.e;
54
- var flag = kotlin_clikt_clikt.$_$.f;
55
- var IllegalStateException_init_$Create$ = kotlin_kotlin.$_$.j1;
56
- var Enum = kotlin_kotlin.$_$.cd;
57
- var KProperty1 = kotlin_kotlin.$_$.ja;
58
- var getPropertyCallableRef = kotlin_kotlin.$_$.r8;
59
- var split = kotlin_kotlin.$_$.bc;
60
- var dropLast = kotlin_kotlin.$_$.f5;
61
- var last = kotlin_kotlin.$_$.i6;
62
- var plus = kotlin_kotlin.$_$.u6;
63
- var joinToString = kotlin_kotlin.$_$.x5;
64
- var readlnOrNull = kotlin_kotlin.$_$.c8;
65
- var generateSequence = kotlin_kotlin.$_$.oa;
66
- var joinToString_0 = kotlin_kotlin.$_$.pa;
67
- var numberRangeToNumber = kotlin_kotlin.$_$.k9;
68
- var ArrayList_init_$Create$ = kotlin_kotlin.$_$.j;
69
- var copyToArray = kotlin_kotlin.$_$.d5;
70
- var Logger = kotlin_community_flock_wirespec_compiler_core.$_$.b1;
71
- var toString = kotlin_kotlin.$_$.v9;
72
- var Companion_getInstance = kotlin_community_flock_wirespec_converter_openapi.$_$.a;
73
- var Companion_getInstance_0 = kotlin_community_flock_wirespec_converter_openapi.$_$.b;
74
- var noWhenBranchMatchedException = kotlin_kotlin.$_$.ge;
75
- var collectionSizeOrDefault = kotlin_kotlin.$_$.q4;
76
- var ArrayList_init_$Create$_0 = kotlin_kotlin.$_$.i;
77
- var to = kotlin_kotlin.$_$.je;
78
- var charSequenceLength = kotlin_kotlin.$_$.j8;
79
- var charSequenceGet = kotlin_kotlin.$_$.i8;
80
- var toString_0 = kotlin_kotlin.$_$.v1;
81
- var first = kotlin_kotlin.$_$.n5;
82
- var Emitted = kotlin_community_flock_wirespec_compiler_core.$_$.b;
83
- var enumEntries = kotlin_kotlin.$_$.y7;
84
- var isInterface = kotlin_kotlin.$_$.d9;
85
- var interfaceMeta = kotlin_kotlin.$_$.u8;
86
- var print = kotlin_kotlin.$_$.b8;
87
- var WirespecEmitter = kotlin_community_flock_wirespec_compiler_core.$_$.g;
88
- var TypeScriptEmitter = kotlin_community_flock_wirespec_compiler_core.$_$.f;
89
- var ScalaEmitter = kotlin_community_flock_wirespec_compiler_core.$_$.e;
90
- var KotlinEmitter = kotlin_community_flock_wirespec_compiler_core.$_$.d;
91
- var JavaEmitter = kotlin_community_flock_wirespec_compiler_core.$_$.c;
92
- var Wirespec_getInstance = kotlin_community_flock_wirespec_compiler_core.$_$.h1;
93
- var compile = kotlin_community_flock_wirespec_compiler_core.$_$.a1;
94
- var Left = kotlin_io_arrow_kt_arrow_core.$_$.c;
95
- var Companion_getInstance_1 = kotlin_community_flock_wirespec_compiler_core.$_$.g1;
96
- var Right = kotlin_io_arrow_kt_arrow_core.$_$.d;
97
- var println = kotlin_kotlin.$_$.z7;
98
- var ensureNotNull = kotlin_kotlin.$_$.ae;
99
- var _Char___init__impl__6a9atx = kotlin_kotlin.$_$.r1;
100
- var charArrayOf = kotlin_kotlin.$_$.g8;
101
- var split_0 = kotlin_kotlin.$_$.ac;
102
- var endsWith = kotlin_kotlin.$_$.bb;
103
- var dropLast_0 = kotlin_kotlin.$_$.za;
104
- var iterator = kotlin_kotlin.$_$.h9;
105
- var asSequence = kotlin_kotlin.$_$.la;
106
- var map = kotlin_kotlin.$_$.qa;
107
- var filter = kotlin_kotlin.$_$.ma;
108
- var toSet_0 = kotlin_kotlin.$_$.sa;
109
- var Companion_getInstance_2 = kotlin_kotlin.$_$.o3;
110
- var _Result___init__impl__xyqfz8 = kotlin_kotlin.$_$.w1;
111
- var createFailure = kotlin_kotlin.$_$.zd;
112
- var _Result___get_value__impl__bjfvqg = kotlin_kotlin.$_$.a2;
113
- var isObject = kotlin_kotlin.$_$.f9;
114
- var _Result___get_isFailure__impl__jpiriv = kotlin_kotlin.$_$.y1;
115
- var isArray = kotlin_kotlin.$_$.v8;
116
- //endregion
117
- //region block: pre-declaration
118
- setMetadataFor(Companion, 'Companion', objectMeta);
119
- setMetadataFor(WirespecCli, 'WirespecCli', classMeta, NoOpCliktCommand);
120
- setMetadataFor(Arguments, 'Arguments', classMeta);
121
- setMetadataFor(Compile, 'Compile', objectMeta);
122
- setMetadataFor(Convert, 'Convert', classMeta);
123
- setMetadataFor(CommonOptions, 'CommonOptions', classMeta, CliktCommand);
124
- setMetadataFor(Compile_0, 'Compile', classMeta, CommonOptions);
125
- setMetadataFor(Convert_0, 'Convert', classMeta, CommonOptions);
126
- setMetadataFor(Options, 'Options', classMeta, Enum);
127
- setMetadataFor(Companion_0, 'Companion', objectMeta);
128
- setMetadataFor(FullFilePath, 'FullFilePath', classMeta);
129
- setMetadataFor(Console, 'Console', objectMeta);
130
- setMetadataFor(FullDirPath, 'FullDirPath', classMeta);
131
- setMetadataFor(Language, 'Language', interfaceMeta);
132
- setMetadataFor(Jvm, 'Jvm', classMeta, Enum, [Enum, Language]);
133
- setMetadataFor(Script, 'Script', classMeta, Enum, [Enum, Language]);
134
- setMetadataFor(Spec, 'Spec', classMeta, Enum, [Enum, Language]);
135
- setMetadataFor(Companion_1, 'Companion', objectMeta);
136
- setMetadataFor(Companion_2, 'Companion', objectMeta);
137
- setMetadataFor(Format, 'Format', classMeta, Enum);
138
- setMetadataFor(Extension, 'Extension', classMeta, Enum);
139
- setMetadataFor(File, 'File', classMeta);
140
- setMetadataFor(JavaFile, 'JavaFile', classMeta, File);
141
- setMetadataFor(JsonFile, 'JsonFile', classMeta, File);
142
- setMetadataFor(KotlinFile, 'KotlinFile', classMeta, File);
143
- setMetadataFor(ScalaFile, 'ScalaFile', classMeta, File);
144
- setMetadataFor(TypeScriptFile, 'TypeScriptFile', classMeta, File);
145
- setMetadataFor(WirespecFile, 'WirespecFile', classMeta, File);
146
- setMetadataFor(Directory, 'Directory', classMeta);
147
- //endregion
148
- function WirespecCli$main$ref($boundThis) {
149
- var l = function (p0) {
150
- $boundThis.o3d(p0);
151
- return Unit_getInstance();
152
- };
153
- l.callableName = 'main';
154
- return l;
155
- }
156
- function Companion() {
157
- Companion_instance = this;
158
- }
159
- protoOf(Companion).o3p = function (compile, convert) {
160
- return WirespecCli$main$ref(subcommands(new WirespecCli(), [new Compile_0(compile), new Convert_0(convert)]));
161
- };
162
- var Companion_instance;
163
- function Companion_getInstance_3() {
164
- if (Companion_instance == null)
165
- new Companion();
166
- return Companion_instance;
167
- }
168
- function WirespecCli() {
169
- Companion_getInstance_3();
170
- NoOpCliktCommand.call(this, VOID, VOID, 'wirespec');
171
- }
172
- function Arguments(operation, input, output, languages, packageName, strict, debug) {
173
- this.p3p_1 = operation;
174
- this.q3p_1 = input;
175
- this.r3p_1 = output;
176
- this.s3p_1 = languages;
177
- this.t3p_1 = packageName;
178
- this.u3p_1 = strict;
179
- this.v3p_1 = debug;
180
- }
181
- protoOf(Arguments).toString = function () {
182
- return 'Arguments(operation=' + this.p3p_1 + ', input=' + this.q3p_1 + ', output=' + this.r3p_1 + ', languages=' + this.s3p_1 + ', packageName=' + this.t3p_1 + ', strict=' + this.u3p_1 + ', debug=' + this.v3p_1 + ')';
183
- };
184
- protoOf(Arguments).hashCode = function () {
185
- var result = hashCode(this.p3p_1);
186
- result = imul(result, 31) + hashCode(this.q3p_1) | 0;
187
- result = imul(result, 31) + (this.r3p_1 == null ? 0 : getStringHashCode(this.r3p_1)) | 0;
188
- result = imul(result, 31) + hashCode(this.s3p_1) | 0;
189
- result = imul(result, 31) + getStringHashCode(this.t3p_1) | 0;
190
- result = imul(result, 31) + (this.u3p_1 | 0) | 0;
191
- result = imul(result, 31) + (this.v3p_1 | 0) | 0;
192
- return result;
193
- };
194
- protoOf(Arguments).equals = function (other) {
195
- if (this === other)
196
- return true;
197
- if (!(other instanceof Arguments))
198
- return false;
199
- var tmp0_other_with_cast = other instanceof Arguments ? other : THROW_CCE();
200
- if (!equals(this.p3p_1, tmp0_other_with_cast.p3p_1))
201
- return false;
202
- if (!equals(this.q3p_1, tmp0_other_with_cast.q3p_1))
203
- return false;
204
- if (!(this.r3p_1 == tmp0_other_with_cast.r3p_1))
205
- return false;
206
- if (!equals(this.s3p_1, tmp0_other_with_cast.s3p_1))
207
- return false;
208
- if (!(this.t3p_1 === tmp0_other_with_cast.t3p_1))
209
- return false;
210
- if (!(this.u3p_1 === tmp0_other_with_cast.u3p_1))
211
- return false;
212
- if (!(this.v3p_1 === tmp0_other_with_cast.v3p_1))
213
- return false;
214
- return true;
215
- };
216
- function Compile() {
217
- Compile_instance = this;
218
- }
219
- protoOf(Compile).toString = function () {
220
- return 'Compile';
221
- };
222
- protoOf(Compile).hashCode = function () {
223
- return -1309483685;
224
- };
225
- protoOf(Compile).equals = function (other) {
226
- if (this === other)
227
- return true;
228
- if (!(other instanceof Compile))
229
- return false;
230
- other instanceof Compile || THROW_CCE();
231
- return true;
232
- };
233
- var Compile_instance;
234
- function Compile_getInstance() {
235
- if (Compile_instance == null)
236
- new Compile();
237
- return Compile_instance;
238
- }
239
- function Convert(format) {
240
- this.w3p_1 = format;
241
- }
242
- protoOf(Convert).toString = function () {
243
- return 'Convert(format=' + this.w3p_1 + ')';
244
- };
245
- protoOf(Convert).hashCode = function () {
246
- return this.w3p_1.hashCode();
247
- };
248
- protoOf(Convert).equals = function (other) {
249
- if (this === other)
250
- return true;
251
- if (!(other instanceof Convert))
252
- return false;
253
- var tmp0_other_with_cast = other instanceof Convert ? other : THROW_CCE();
254
- if (!this.w3p_1.equals(tmp0_other_with_cast.w3p_1))
255
- return false;
256
- return true;
257
- };
258
- function _get_languages__ojonze($this) {
259
- return $this.v3q_1.q3m($this, languages$factory_0());
260
- }
261
- function Compile_0(block) {
262
- CommonOptions.call(this);
263
- this.u3q_1 = block;
264
- this.v3q_1 = multiple(choice(option(this, Options_Language_getInstance().y3q_1.slice(), 'Language'), Companion_getInstance_5().z3q()), VOID, true).s3n(this, languages$factory());
265
- }
266
- protoOf(Compile_0).p3d = function () {
267
- // Inline function 'kotlin.let' call
268
- var tmp0_let = new Arguments(Compile_getInstance(), this.y3r(this.x3r()), this.z3r(), toSet(_get_languages__ojonze(this)), this.a3s(), this.b3s(), this.c3s());
269
- // Inline function 'kotlin.contracts.contract' call
270
- this.u3q_1(tmp0_let);
271
- };
272
- function _get_format__qlarck($this) {
273
- return $this.b3t_1.q3m($this, format$factory_0());
274
- }
275
- function _get_languages__ojonze_0($this) {
276
- return $this.c3t_1.q3m($this, languages$factory_2());
277
- }
278
- function Convert_0(block) {
279
- CommonOptions.call(this);
280
- this.a3t_1 = block;
281
- var tmp = this;
282
- // Inline function 'com.github.ajalt.clikt.parameters.types.enum' call
283
- var tmp0_enum = argument(this, VOID, 'Input format');
284
- // Inline function 'kotlin.collections.associateBy' call
285
- // Inline function 'kotlin.enumValues' call
286
- var tmp0_associateBy = values_3();
287
- var capacity = coerceAtLeast(mapCapacity(tmp0_associateBy.length), 16);
288
- // Inline function 'kotlin.collections.associateByTo' call
289
- var tmp0_associateByTo = LinkedHashMap_init_$Create$(capacity);
290
- var inductionVariable = 0;
291
- var last = tmp0_associateBy.length;
292
- while (inductionVariable < last) {
293
- var element = tmp0_associateBy[inductionVariable];
294
- inductionVariable = inductionVariable + 1 | 0;
295
- var tmp$ret$2;
296
- // Inline function 'com.github.ajalt.clikt.parameters.types.enum.<anonymous>' call
297
- // Inline function 'com.github.ajalt.clikt.parameters.types.enum.<anonymous>' call
298
- tmp$ret$2 = element.o5_1;
299
- tmp0_associateByTo.n3(tmp$ret$2, element);
300
- }
301
- tmp.b3t_1 = choice_0(tmp0_enum, tmp0_associateByTo, true).w3l(this, format$factory());
302
- this.c3t_1 = multiple(choice(option(this, Options_Language_getInstance().y3q_1.slice(), 'Language'), Companion_getInstance_5().z3q(), VOID, true), listOf(Spec_Wirespec_getInstance())).s3n(this, languages$factory_1());
303
- }
304
- protoOf(Convert_0).p3d = function () {
305
- if (this.x3r() == null)
306
- null;
307
- else {
308
- // Inline function 'kotlin.let' call
309
- // Inline function 'kotlin.contracts.contract' call
310
- this.i3d('To convert, please specify a file', VOID, true);
311
- }
312
- // Inline function 'kotlin.let' call
313
- var tmp = new Convert(_get_format__qlarck(this));
314
- var tmp_0 = this.y3r(null);
315
- var tmp_1 = this.z3r();
316
- var tmp$ret$2;
317
- // Inline function 'kotlin.collections.ifEmpty' call
318
- var tmp0_ifEmpty = toSet(_get_languages__ojonze_0(this));
319
- var tmp_2;
320
- if (tmp0_ifEmpty.l()) {
321
- // Inline function 'community.flock.wirespec.compiler.cli.Convert.run.<anonymous>' call
322
- tmp_2 = setOf(Spec_Wirespec_getInstance());
323
- } else {
324
- tmp_2 = tmp0_ifEmpty;
325
- }
326
- tmp$ret$2 = tmp_2;
327
- var tmp1_let = new Arguments(tmp, tmp_0, tmp_1, tmp$ret$2, this.a3s(), this.b3s(), this.c3s());
328
- // Inline function 'kotlin.contracts.contract' call
329
- this.a3t_1(tmp1_let);
330
- };
331
- function _get_inputFile__x1bqj($this) {
332
- return $this.r3r_1.q3m($this, inputFile$factory_0());
333
- }
334
- function CommonOptions() {
335
- CliktCommand.call(this);
336
- this.r3r_1 = option(this, Options_InputFile_getInstance().y3q_1.slice(), 'Input file').s3n(this, inputFile$factory());
337
- this.s3r_1 = option(this, Options_InputDir_getInstance().y3q_1.slice(), 'Input directory').s3n(this, inputDir$factory());
338
- this.t3r_1 = option(this, Options_OutputDir_getInstance().y3q_1.slice(), 'Output directory').s3n(this, outputDir$factory());
339
- this.u3r_1 = default_0(option(this, Options_PackageName_getInstance().y3q_1.slice(), 'Package name'), get_DEFAULT_PACKAGE_NAME()).s3n(this, packageName$factory());
340
- this.v3r_1 = flag(option(this, Options_Strict_getInstance().y3q_1.slice(), 'Strict mode'), []).s3n(this, strict$factory());
341
- this.w3r_1 = flag(option(this, Options_Debug_getInstance().y3q_1.slice(), 'Debug mode'), []).s3n(this, debug$factory());
342
- }
343
- protoOf(CommonOptions).x3r = function () {
344
- return this.s3r_1.q3m(this, inputDir$factory_0());
345
- };
346
- protoOf(CommonOptions).z3r = function () {
347
- return this.t3r_1.q3m(this, outputDir$factory_0());
348
- };
349
- protoOf(CommonOptions).a3s = function () {
350
- return this.u3r_1.q3m(this, packageName$factory_0());
351
- };
352
- protoOf(CommonOptions).b3s = function () {
353
- return this.v3r_1.q3m(this, strict$factory_0());
354
- };
355
- protoOf(CommonOptions).c3s = function () {
356
- return this.w3r_1.q3m(this, debug$factory_0());
357
- };
358
- protoOf(CommonOptions).y3r = function (inputDir) {
359
- var tmp;
360
- if (!(inputDir == null) ? !(_get_inputFile__x1bqj(this) == null) : false) {
361
- throw IllegalStateException_init_$Create$('Choose either a file or a directory. Not Both.');
362
- } else {
363
- var tmp0_safe_receiver = _get_inputFile__x1bqj(this);
364
- var tmp_0;
365
- if (tmp0_safe_receiver == null) {
366
- tmp_0 = null;
367
- } else {
368
- // Inline function 'kotlin.let' call
369
- // Inline function 'kotlin.contracts.contract' call
370
- tmp_0 = Companion_getInstance_4().d3t(tmp0_safe_receiver);
371
- }
372
- var tmp2_elvis_lhs = tmp_0;
373
- var tmp_1;
374
- if (tmp2_elvis_lhs == null) {
375
- var tmp_2;
376
- if (inputDir == null) {
377
- tmp_2 = null;
378
- } else {
379
- // Inline function 'kotlin.let' call
380
- // Inline function 'kotlin.contracts.contract' call
381
- tmp_2 = new FullDirPath(inputDir);
382
- }
383
- tmp_1 = tmp_2;
384
- } else {
385
- tmp_1 = tmp2_elvis_lhs;
386
- }
387
- var tmp3_elvis_lhs = tmp_1;
388
- tmp = tmp3_elvis_lhs == null ? Console_getInstance() : tmp3_elvis_lhs;
389
- }
390
- return tmp;
391
- };
392
- var Options_InputDir_instance;
393
- var Options_InputFile_instance;
394
- var Options_OutputDir_instance;
395
- var Options_Language_instance;
396
- var Options_PackageName_instance;
397
- var Options_Strict_instance;
398
- var Options_Debug_instance;
399
- var Options_entriesInitialized;
400
- function Options_initEntries() {
401
- if (Options_entriesInitialized)
402
- return Unit_getInstance();
403
- Options_entriesInitialized = true;
404
- Options_InputDir_instance = new Options('InputDir', 0, ['-d', '--input-dir']);
405
- Options_InputFile_instance = new Options('InputFile', 1, ['-f', '--input-file']);
406
- Options_OutputDir_instance = new Options('OutputDir', 2, ['-o', '--output-dir']);
407
- Options_Language_instance = new Options('Language', 3, ['-l', '--language']);
408
- Options_PackageName_instance = new Options('PackageName', 4, ['-p', '--package']);
409
- Options_Strict_instance = new Options('Strict', 5, ['--strict']);
410
- Options_Debug_instance = new Options('Debug', 6, ['--debug']);
411
- }
412
- function Options(name, ordinal, flags) {
413
- Enum.call(this, name, ordinal);
414
- this.y3q_1 = flags;
415
- }
416
- function Options_InputDir_getInstance() {
417
- Options_initEntries();
418
- return Options_InputDir_instance;
419
- }
420
- function Options_InputFile_getInstance() {
421
- Options_initEntries();
422
- return Options_InputFile_instance;
423
- }
424
- function Options_OutputDir_getInstance() {
425
- Options_initEntries();
426
- return Options_OutputDir_instance;
427
- }
428
- function Options_Language_getInstance() {
429
- Options_initEntries();
430
- return Options_Language_instance;
431
- }
432
- function Options_PackageName_getInstance() {
433
- Options_initEntries();
434
- return Options_PackageName_instance;
435
- }
436
- function Options_Strict_getInstance() {
437
- Options_initEntries();
438
- return Options_Strict_instance;
439
- }
440
- function Options_Debug_getInstance() {
441
- Options_initEntries();
442
- return Options_Debug_instance;
443
- }
444
- function languages$factory() {
445
- return getPropertyCallableRef('languages', 1, KProperty1, function (receiver) {
446
- return _get_languages__ojonze(receiver);
447
- }, null);
448
- }
449
- function languages$factory_0() {
450
- return getPropertyCallableRef('languages', 1, KProperty1, function (receiver) {
451
- return _get_languages__ojonze(receiver);
452
- }, null);
453
- }
454
- function format$factory() {
455
- return getPropertyCallableRef('format', 1, KProperty1, function (receiver) {
456
- return _get_format__qlarck(receiver);
457
- }, null);
458
- }
459
- function languages$factory_1() {
460
- return getPropertyCallableRef('languages', 1, KProperty1, function (receiver) {
461
- return _get_languages__ojonze_0(receiver);
462
- }, null);
463
- }
464
- function format$factory_0() {
465
- return getPropertyCallableRef('format', 1, KProperty1, function (receiver) {
466
- return _get_format__qlarck(receiver);
467
- }, null);
468
- }
469
- function languages$factory_2() {
470
- return getPropertyCallableRef('languages', 1, KProperty1, function (receiver) {
471
- return _get_languages__ojonze_0(receiver);
472
- }, null);
473
- }
474
- function inputFile$factory() {
475
- return getPropertyCallableRef('inputFile', 1, KProperty1, function (receiver) {
476
- return _get_inputFile__x1bqj(receiver);
477
- }, null);
478
- }
479
- function inputDir$factory() {
480
- return getPropertyCallableRef('inputDir', 1, KProperty1, function (receiver) {
481
- return receiver.x3r();
482
- }, null);
483
- }
484
- function outputDir$factory() {
485
- return getPropertyCallableRef('outputDir', 1, KProperty1, function (receiver) {
486
- return receiver.z3r();
487
- }, null);
488
- }
489
- function packageName$factory() {
490
- return getPropertyCallableRef('packageName', 1, KProperty1, function (receiver) {
491
- return receiver.a3s();
492
- }, null);
493
- }
494
- function strict$factory() {
495
- return getPropertyCallableRef('strict', 1, KProperty1, function (receiver) {
496
- return receiver.b3s();
497
- }, null);
498
- }
499
- function debug$factory() {
500
- return getPropertyCallableRef('debug', 1, KProperty1, function (receiver) {
501
- return receiver.c3s();
502
- }, null);
503
- }
504
- function inputFile$factory_0() {
505
- return getPropertyCallableRef('inputFile', 1, KProperty1, function (receiver) {
506
- return _get_inputFile__x1bqj(receiver);
507
- }, null);
508
- }
509
- function inputDir$factory_0() {
510
- return getPropertyCallableRef('inputDir', 1, KProperty1, function (receiver) {
511
- return receiver.x3r();
512
- }, null);
513
- }
514
- function outputDir$factory_0() {
515
- return getPropertyCallableRef('outputDir', 1, KProperty1, function (receiver) {
516
- return receiver.z3r();
517
- }, null);
518
- }
519
- function packageName$factory_0() {
520
- return getPropertyCallableRef('packageName', 1, KProperty1, function (receiver) {
521
- return receiver.a3s();
522
- }, null);
523
- }
524
- function strict$factory_0() {
525
- return getPropertyCallableRef('strict', 1, KProperty1, function (receiver) {
526
- return receiver.b3s();
527
- }, null);
528
- }
529
- function debug$factory_0() {
530
- return getPropertyCallableRef('debug', 1, KProperty1, function (receiver) {
531
- return receiver.c3s();
532
- }, null);
533
- }
534
- function Companion_0() {
535
- Companion_instance_0 = this;
536
- }
537
- protoOf(Companion_0).d3t = function (input) {
538
- // Inline function 'kotlin.let' call
539
- var tmp0_let = split(input, ['/']);
540
- // Inline function 'kotlin.contracts.contract' call
541
- // Inline function 'community.flock.wirespec.compiler.cli.Companion.parse.<anonymous>' call
542
- var list = plus(dropLast(tmp0_let, 1), split(last(tmp0_let), ['.']));
543
- // Inline function 'kotlin.let' call
544
- // Inline function 'kotlin.text.lowercase' call
545
- // Inline function 'kotlin.js.asDynamic' call
546
- var tmp2_let = last(list).toLowerCase();
547
- // Inline function 'kotlin.contracts.contract' call
548
- // Inline function 'community.flock.wirespec.compiler.cli.Companion.parse.<anonymous>' call
549
- // Inline function 'kotlin.collections.find' call
550
- var tmp0_find = get_entries_3();
551
- var tmp$ret$5;
552
- $l$block: {
553
- // Inline function 'kotlin.collections.firstOrNull' call
554
- var tmp0_iterator = tmp0_find.c();
555
- while (tmp0_iterator.d()) {
556
- var element = tmp0_iterator.e();
557
- // Inline function 'community.flock.wirespec.compiler.cli.Companion.parse.<anonymous>.<anonymous>' call
558
- if (element.g3t_1 === tmp2_let) {
559
- tmp$ret$5 = element;
560
- break $l$block;
561
- }
562
- }
563
- tmp$ret$5 = null;
564
- }
565
- var tmp0_elvis_lhs = tmp$ret$5;
566
- var tmp;
567
- if (tmp0_elvis_lhs == null) {
568
- throw IllegalStateException_init_$Create$('Invalid file extension');
569
- } else {
570
- tmp = tmp0_elvis_lhs;
571
- }
572
- var extension = tmp;
573
- var filename = list.k(list.f() - 2 | 0);
574
- var path = joinToString(list.s(0, list.f() - 2 | 0), '/');
575
- return new FullFilePath(path, filename, extension);
576
- };
577
- var Companion_instance_0;
578
- function Companion_getInstance_4() {
579
- if (Companion_instance_0 == null)
580
- new Companion_0();
581
- return Companion_instance_0;
582
- }
583
- function FullFilePath(directory, fileName, extension) {
584
- Companion_getInstance_4();
585
- extension = extension === VOID ? Extension_Wirespec_getInstance() : extension;
586
- this.h3t_1 = directory;
587
- this.i3t_1 = fileName;
588
- this.j3t_1 = extension;
589
- }
590
- protoOf(FullFilePath).toString = function () {
591
- return this.h3t_1 + '/' + this.i3t_1 + '.' + this.j3t_1.g3t_1;
592
- };
593
- protoOf(FullFilePath).k3t = function (directory, fileName, extension) {
594
- return new FullFilePath(directory, fileName, extension);
595
- };
596
- protoOf(FullFilePath).l3t = function (directory, fileName, extension, $super) {
597
- directory = directory === VOID ? this.h3t_1 : directory;
598
- fileName = fileName === VOID ? this.i3t_1 : fileName;
599
- extension = extension === VOID ? this.j3t_1 : extension;
600
- return $super === VOID ? this.k3t(directory, fileName, extension) : $super.k3t.call(this, directory, fileName, extension);
601
- };
602
- protoOf(FullFilePath).hashCode = function () {
603
- var result = getStringHashCode(this.h3t_1);
604
- result = imul(result, 31) + getStringHashCode(this.i3t_1) | 0;
605
- result = imul(result, 31) + this.j3t_1.hashCode() | 0;
606
- return result;
607
- };
608
- protoOf(FullFilePath).equals = function (other) {
609
- if (this === other)
610
- return true;
611
- if (!(other instanceof FullFilePath))
612
- return false;
613
- var tmp0_other_with_cast = other instanceof FullFilePath ? other : THROW_CCE();
614
- if (!(this.h3t_1 === tmp0_other_with_cast.h3t_1))
615
- return false;
616
- if (!(this.i3t_1 === tmp0_other_with_cast.i3t_1))
617
- return false;
618
- if (!this.j3t_1.equals(tmp0_other_with_cast.j3t_1))
619
- return false;
620
- return true;
621
- };
622
- function Console$read$lambda() {
623
- return readlnOrNull();
624
- }
625
- function Console() {
626
- Console_instance = this;
627
- }
628
- protoOf(Console).q11 = function () {
629
- return joinToString_0(generateSequence(Console$read$lambda), '/n');
630
- };
631
- protoOf(Console).toString = function () {
632
- return 'Console';
633
- };
634
- protoOf(Console).hashCode = function () {
635
- return 1615669478;
636
- };
637
- protoOf(Console).equals = function (other) {
638
- if (this === other)
639
- return true;
640
- if (!(other instanceof Console))
641
- return false;
642
- other instanceof Console || THROW_CCE();
643
- return true;
644
- };
645
- var Console_instance;
646
- function Console_getInstance() {
647
- if (Console_instance == null)
648
- new Console();
649
- return Console_instance;
650
- }
651
- function FullDirPath(path) {
652
- this.m3t_1 = path;
653
- }
654
- protoOf(FullDirPath).toString = function () {
655
- return 'FullDirPath(path=' + this.m3t_1 + ')';
656
- };
657
- protoOf(FullDirPath).hashCode = function () {
658
- return getStringHashCode(this.m3t_1);
659
- };
660
- protoOf(FullDirPath).equals = function (other) {
661
- if (this === other)
662
- return true;
663
- if (!(other instanceof FullDirPath))
664
- return false;
665
- var tmp0_other_with_cast = other instanceof FullDirPath ? other : THROW_CCE();
666
- if (!(this.m3t_1 === tmp0_other_with_cast.m3t_1))
667
- return false;
668
- return true;
669
- };
670
- function main(args) {
671
- // Inline function 'kotlin.let' call
672
- // Inline function 'kotlin.collections.toTypedArray' call
673
- // Inline function 'kotlin.collections.mapNotNull' call
674
- var tmp0_mapNotNull = numberRangeToNumber(0, 20);
675
- // Inline function 'kotlin.collections.mapNotNullTo' call
676
- var tmp0_mapNotNullTo = ArrayList_init_$Create$();
677
- // Inline function 'kotlin.collections.forEach' call
678
- var inductionVariable = tmp0_mapNotNull.a1_1;
679
- var last = tmp0_mapNotNull.b1_1;
680
- if (inductionVariable <= last)
681
- do {
682
- var element = inductionVariable;
683
- inductionVariable = inductionVariable + 1 | 0;
684
- // Inline function 'kotlin.collections.mapNotNullTo.<anonymous>' call
685
- var tmp0_safe_receiver = orNull(args, element);
686
- if (tmp0_safe_receiver == null)
687
- null;
688
- else {
689
- // Inline function 'kotlin.let' call
690
- // Inline function 'kotlin.contracts.contract' call
691
- tmp0_mapNotNullTo.a(tmp0_safe_receiver);
692
- }
693
- }
694
- while (!(element === last));
695
- var tmp2_let = copyToArray(tmp0_mapNotNullTo);
696
- var tmp = Companion_getInstance_3();
697
- var tmp_0 = compile$ref();
698
- // Inline function 'kotlin.contracts.contract' call
699
- tmp.o3p(tmp_0, convert$ref())(tmp2_let);
700
- }
701
- function compile_0(arguments_0) {
702
- var input = arguments_0.q3p_1;
703
- var output = arguments_0.r3p_1;
704
- var languages = arguments_0.s3p_1;
705
- var packageName = arguments_0.t3p_1;
706
- var logger = new Logger(arguments_0.v3p_1);
707
- var tmp0_subject = arguments_0.p3p_1;
708
- if (tmp0_subject instanceof Convert) {
709
- var fullPath = input instanceof FullFilePath ? input : THROW_CCE();
710
- var file = new JsonFile(fullPath);
711
- var strict = arguments_0.u3p_1;
712
- var tmp;
713
- switch (arguments_0.p3p_1.w3p_1.p5_1) {
714
- case 0:
715
- tmp = Companion_getInstance().s21(file.q11(), !strict);
716
- break;
717
- case 1:
718
- tmp = Companion_getInstance_0().s21(file.q11(), !strict);
719
- break;
720
- default:
721
- noWhenBranchMatchedException();
722
- break;
723
- }
724
- var ast = tmp;
725
- var path = out(fullPath, packageName, output);
726
- // Inline function 'kotlin.collections.map' call
727
- // Inline function 'kotlin.collections.map' call
728
- var tmp0_map = emitters(languages, packageName, path, logger);
729
- // Inline function 'kotlin.collections.mapTo' call
730
- var tmp0_mapTo = ArrayList_init_$Create$_0(collectionSizeOrDefault(tmp0_map, 10));
731
- var tmp0_iterator = tmp0_map.c();
732
- while (tmp0_iterator.d()) {
733
- var item = tmp0_iterator.e();
734
- var tmp$ret$7;
735
- // Inline function 'community.flock.wirespec.compiler.cli.compile.<anonymous>' call
736
- var emitter = item.e3();
737
- var file_0 = item.f3();
738
- var results = emitter.x1q(ast);
739
- var tmp_0;
740
- if (!emitter.h1w()) {
741
- var tmp$ret$6;
742
- // Inline function 'kotlin.text.replaceFirstChar' call
743
- var tmp0_replaceFirstChar = fullPath.i3t_1;
744
- var tmp_1;
745
- // Inline function 'kotlin.text.isNotEmpty' call
746
- if (charSequenceLength(tmp0_replaceFirstChar) > 0) {
747
- var tmp$ret$3;
748
- // Inline function 'kotlin.text.uppercase' call
749
- var tmp1_uppercase = charSequenceGet(tmp0_replaceFirstChar, 0);
750
- // Inline function 'kotlin.js.unsafeCast' call
751
- // Inline function 'kotlin.js.asDynamic' call
752
- tmp$ret$3 = toString_0(tmp1_uppercase).toUpperCase();
753
- var tmp_2 = toString(tmp$ret$3);
754
- // Inline function 'kotlin.text.substring' call
755
- // Inline function 'kotlin.js.asDynamic' call
756
- tmp_1 = tmp_2 + tmp0_replaceFirstChar.substring(1);
757
- } else {
758
- tmp_1 = tmp0_replaceFirstChar;
759
- }
760
- tmp$ret$6 = tmp_1;
761
- tmp_0 = to(listOf(new Emitted(tmp$ret$6, first(results).o1s_1)), file_0);
762
- } else {
763
- tmp_0 = to(results, file_0);
764
- }
765
- tmp$ret$7 = tmp_0;
766
- tmp0_mapTo.a(tmp$ret$7);
767
- }
768
- // Inline function 'kotlin.collections.mapTo' call
769
- var tmp0_mapTo_0 = ArrayList_init_$Create$_0(collectionSizeOrDefault(tmp0_mapTo, 10));
770
- var tmp0_iterator_0 = tmp0_mapTo.c();
771
- while (tmp0_iterator_0.d()) {
772
- var item_0 = tmp0_iterator_0.e();
773
- var results_0 = item_0.e3();
774
- var file_1 = item_0.f3();
775
- write(results_0, file_1);
776
- tmp0_mapTo_0.a(Unit_getInstance());
777
- }
778
- } else {
779
- if (tmp0_subject instanceof Compile) {
780
- if (input instanceof Console) {
781
- wirespec(input, languages, packageName, compile$lambda(output), logger);
782
- } else {
783
- if (input instanceof FullDirPath) {
784
- // Inline function 'kotlin.collections.forEach' call
785
- var tmp0_iterator_1 = (new Directory(input.m3t_1)).p3t().c();
786
- while (tmp0_iterator_1.d()) {
787
- var element = tmp0_iterator_1.e();
788
- // Inline function 'community.flock.wirespec.compiler.cli.compile.<anonymous>' call
789
- wirespec(element, languages, packageName, out(element.n3t_1, packageName, output), logger);
790
- }
791
- } else {
792
- if (input instanceof FullFilePath)
793
- if (input.j3t_1.equals(Extension_Wirespec_getInstance())) {
794
- // Inline function 'kotlin.let' call
795
- var tmp3_let = new WirespecFile(input);
796
- // Inline function 'kotlin.contracts.contract' call
797
- wirespec(tmp3_let, languages, packageName, out(tmp3_let.n3t_1, packageName, output), logger);
798
- } else {
799
- // Inline function 'kotlin.error' call
800
- var tmp4_error = 'Path ' + input + ' is not a Wirespec file';
801
- throw IllegalStateException_init_$Create$(toString(tmp4_error));
802
- }
803
- }
804
- }
805
- }
806
- }
807
- }
808
- function convert(arguments_0) {
809
- return compile_0(arguments_0);
810
- }
811
- var Jvm_Java_instance;
812
- var Jvm_Kotlin_instance;
813
- var Jvm_Scala_instance;
814
- function values() {
815
- return [Jvm_Java_getInstance(), Jvm_Kotlin_getInstance(), Jvm_Scala_getInstance()];
816
- }
817
- function get_entries() {
818
- if ($ENTRIES == null)
819
- $ENTRIES = enumEntries(values());
820
- return $ENTRIES;
821
- }
822
- var Jvm_entriesInitialized;
823
- function Jvm_initEntries() {
824
- if (Jvm_entriesInitialized)
825
- return Unit_getInstance();
826
- Jvm_entriesInitialized = true;
827
- Jvm_Java_instance = new Jvm('Java', 0);
828
- Jvm_Kotlin_instance = new Jvm('Kotlin', 1);
829
- Jvm_Scala_instance = new Jvm('Scala', 2);
830
- }
831
- var $ENTRIES;
832
- var Script_TypeScript_instance;
833
- function values_0() {
834
- return [Script_TypeScript_getInstance()];
835
- }
836
- function get_entries_0() {
837
- if ($ENTRIES_0 == null)
838
- $ENTRIES_0 = enumEntries(values_0());
839
- return $ENTRIES_0;
840
- }
841
- var Script_entriesInitialized;
842
- function Script_initEntries() {
843
- if (Script_entriesInitialized)
844
- return Unit_getInstance();
845
- Script_entriesInitialized = true;
846
- Script_TypeScript_instance = new Script('TypeScript', 0);
847
- }
848
- var $ENTRIES_0;
849
- var Spec_Wirespec_instance;
850
- function values_1() {
851
- return [Spec_Wirespec_getInstance()];
852
- }
853
- function get_entries_1() {
854
- if ($ENTRIES_1 == null)
855
- $ENTRIES_1 = enumEntries(values_1());
856
- return $ENTRIES_1;
857
- }
858
- var Spec_entriesInitialized;
859
- function Spec_initEntries() {
860
- if (Spec_entriesInitialized)
861
- return Unit_getInstance();
862
- Spec_entriesInitialized = true;
863
- Spec_Wirespec_instance = new Spec('Wirespec', 0);
864
- }
865
- var $ENTRIES_1;
866
- function values_2($this) {
867
- return plus(plus(get_entries(), get_entries_0()), get_entries_1());
868
- }
869
- function Jvm(name, ordinal) {
870
- Enum.call(this, name, ordinal);
871
- }
872
- function Script(name, ordinal) {
873
- Enum.call(this, name, ordinal);
874
- }
875
- function Spec(name, ordinal) {
876
- Enum.call(this, name, ordinal);
877
- }
878
- function Companion_1() {
879
- Companion_instance_1 = this;
880
- }
881
- protoOf(Companion_1).z3q = function () {
882
- // Inline function 'kotlin.collections.mapValues' call
883
- // Inline function 'kotlin.collections.associateBy' call
884
- var tmp0_associateBy = values_2(this);
885
- var capacity = coerceAtLeast(mapCapacity(collectionSizeOrDefault(tmp0_associateBy, 10)), 16);
886
- // Inline function 'kotlin.collections.associateByTo' call
887
- var tmp0_associateByTo = LinkedHashMap_init_$Create$(capacity);
888
- var tmp0_iterator = tmp0_associateBy.c();
889
- while (tmp0_iterator.d()) {
890
- var element = tmp0_iterator.e();
891
- var tmp$ret$0;
892
- // Inline function 'community.flock.wirespec.compiler.cli.Companion.toMap.<anonymous>' call
893
- tmp$ret$0 = element.o5_1;
894
- tmp0_associateByTo.n3(tmp$ret$0, element);
895
- }
896
- // Inline function 'kotlin.collections.mapValuesTo' call
897
- var tmp0_mapValuesTo = LinkedHashMap_init_$Create$(mapCapacity(tmp0_associateByTo.f()));
898
- // Inline function 'kotlin.collections.associateByTo' call
899
- var tmp0_iterator_0 = tmp0_associateByTo.w().c();
900
- while (tmp0_iterator_0.d()) {
901
- var element_0 = tmp0_iterator_0.e();
902
- // Inline function 'kotlin.collections.mapValuesTo.<anonymous>' call
903
- var tmp = element_0.x();
904
- var tmp$ret$5;
905
- // Inline function 'community.flock.wirespec.compiler.cli.Companion.toMap.<anonymous>' call
906
- // Inline function 'kotlin.collections.component2' call
907
- var v = element_0.y();
908
- tmp$ret$5 = isInterface(v, Language) ? v : THROW_CCE();
909
- tmp0_mapValuesTo.n3(tmp, tmp$ret$5);
910
- }
911
- return tmp0_mapValuesTo;
912
- };
913
- protoOf(Companion_1).toString = function () {
914
- return joinToString(values_2(this));
915
- };
916
- var Companion_instance_1;
917
- function Companion_getInstance_5() {
918
- if (Companion_instance_1 == null)
919
- new Companion_1();
920
- return Companion_instance_1;
921
- }
922
- function Jvm_Java_getInstance() {
923
- Jvm_initEntries();
924
- return Jvm_Java_instance;
925
- }
926
- function Jvm_Kotlin_getInstance() {
927
- Jvm_initEntries();
928
- return Jvm_Kotlin_instance;
929
- }
930
- function Jvm_Scala_getInstance() {
931
- Jvm_initEntries();
932
- return Jvm_Scala_instance;
933
- }
934
- function Script_TypeScript_getInstance() {
935
- Script_initEntries();
936
- return Script_TypeScript_instance;
937
- }
938
- function Spec_Wirespec_getInstance() {
939
- Spec_initEntries();
940
- return Spec_Wirespec_instance;
941
- }
942
- function Language() {
943
- }
944
- var Format_OpenApiV2_instance;
945
- var Format_OpenApiV3_instance;
946
- function Companion_2() {
947
- Companion_instance_2 = this;
948
- }
949
- protoOf(Companion_2).toString = function () {
950
- return joinToString(get_entries_2());
951
- };
952
- var Companion_instance_2;
953
- function Companion_getInstance_6() {
954
- Format_initEntries();
955
- if (Companion_instance_2 == null)
956
- new Companion_2();
957
- return Companion_instance_2;
958
- }
959
- function values_3() {
960
- return [Format_OpenApiV2_getInstance(), Format_OpenApiV3_getInstance()];
961
- }
962
- function get_entries_2() {
963
- if ($ENTRIES_2 == null)
964
- $ENTRIES_2 = enumEntries(values_3());
965
- return $ENTRIES_2;
966
- }
967
- var Format_entriesInitialized;
968
- function Format_initEntries() {
969
- if (Format_entriesInitialized)
970
- return Unit_getInstance();
971
- Format_entriesInitialized = true;
972
- Format_OpenApiV2_instance = new Format('OpenApiV2', 0);
973
- Format_OpenApiV3_instance = new Format('OpenApiV3', 1);
974
- Companion_getInstance_6();
975
- }
976
- var $ENTRIES_2;
977
- function Format(name, ordinal) {
978
- Enum.call(this, name, ordinal);
979
- }
980
- function out(_this__u8e3s4, packageName, output) {
981
- return out$lambda(output, _this__u8e3s4, packageName);
982
- }
983
- function write(output, file) {
984
- // Inline function 'kotlin.collections.forEach' call
985
- var tmp0_iterator = output.c();
986
- while (tmp0_iterator.d()) {
987
- var element = tmp0_iterator.e();
988
- // Inline function 'community.flock.wirespec.compiler.cli.write.<anonymous>' call
989
- var name = element.e3();
990
- var result = element.f3();
991
- var tmp1_safe_receiver = file == null ? null : file.q3t(name);
992
- var tmp;
993
- if (tmp1_safe_receiver == null) {
994
- tmp = null;
995
- } else {
996
- tmp1_safe_receiver.r3t(result);
997
- tmp = Unit_getInstance();
998
- }
999
- if (tmp == null) {
1000
- print(result);
1001
- }
1002
- }
1003
- }
1004
- function emitters(_this__u8e3s4, packageName, path, logger) {
1005
- // Inline function 'kotlin.collections.map' call
1006
- // Inline function 'kotlin.collections.mapTo' call
1007
- var tmp0_mapTo = ArrayList_init_$Create$_0(collectionSizeOrDefault(_this__u8e3s4, 10));
1008
- var tmp0_iterator = _this__u8e3s4.c();
1009
- while (tmp0_iterator.d()) {
1010
- var item = tmp0_iterator.e();
1011
- var tmp$ret$10;
1012
- // Inline function 'community.flock.wirespec.compiler.cli.emitters.<anonymous>' call
1013
- var tmp;
1014
- if (equals(item, Jvm_Java_getInstance())) {
1015
- var tmp_0 = new JavaEmitter(packageName, logger);
1016
- var tmp_1;
1017
- if (path == null) {
1018
- tmp_1 = null;
1019
- } else {
1020
- // Inline function 'kotlin.let' call
1021
- // Inline function 'kotlin.contracts.contract' call
1022
- // Inline function 'community.flock.wirespec.compiler.cli.emitters.<anonymous>.<anonymous>' call
1023
- tmp_1 = new JavaFile(path(Extension_Java_getInstance()));
1024
- }
1025
- tmp = to(tmp_0, tmp_1);
1026
- } else if (equals(item, Jvm_Kotlin_getInstance())) {
1027
- var tmp_2 = new KotlinEmitter(packageName, logger);
1028
- var tmp_3;
1029
- if (path == null) {
1030
- tmp_3 = null;
1031
- } else {
1032
- // Inline function 'kotlin.let' call
1033
- // Inline function 'kotlin.contracts.contract' call
1034
- // Inline function 'community.flock.wirespec.compiler.cli.emitters.<anonymous>.<anonymous>' call
1035
- tmp_3 = new KotlinFile(path(Extension_Kotlin_getInstance()));
1036
- }
1037
- tmp = to(tmp_2, tmp_3);
1038
- } else if (equals(item, Jvm_Scala_getInstance())) {
1039
- var tmp_4 = new ScalaEmitter(packageName, logger);
1040
- var tmp_5;
1041
- if (path == null) {
1042
- tmp_5 = null;
1043
- } else {
1044
- // Inline function 'kotlin.let' call
1045
- // Inline function 'kotlin.contracts.contract' call
1046
- // Inline function 'community.flock.wirespec.compiler.cli.emitters.<anonymous>.<anonymous>' call
1047
- tmp_5 = new ScalaFile(path(Extension_Scala_getInstance()));
1048
- }
1049
- tmp = to(tmp_4, tmp_5);
1050
- } else if (equals(item, Script_TypeScript_getInstance())) {
1051
- var tmp_6 = new TypeScriptEmitter(logger);
1052
- var tmp_7;
1053
- if (path == null) {
1054
- tmp_7 = null;
1055
- } else {
1056
- // Inline function 'kotlin.let' call
1057
- // Inline function 'kotlin.contracts.contract' call
1058
- // Inline function 'community.flock.wirespec.compiler.cli.emitters.<anonymous>.<anonymous>' call
1059
- tmp_7 = new TypeScriptFile(path(Extension_TypeScript_getInstance()));
1060
- }
1061
- tmp = to(tmp_6, tmp_7);
1062
- } else if (equals(item, Spec_Wirespec_getInstance())) {
1063
- var tmp_8 = new WirespecEmitter(logger);
1064
- var tmp_9;
1065
- if (path == null) {
1066
- tmp_9 = null;
1067
- } else {
1068
- // Inline function 'kotlin.let' call
1069
- // Inline function 'kotlin.contracts.contract' call
1070
- // Inline function 'community.flock.wirespec.compiler.cli.emitters.<anonymous>.<anonymous>' call
1071
- tmp_9 = new WirespecFile(path(Extension_Wirespec_getInstance()));
1072
- }
1073
- tmp = to(tmp_8, tmp_9);
1074
- } else {
1075
- noWhenBranchMatchedException();
1076
- }
1077
- tmp$ret$10 = tmp;
1078
- tmp0_mapTo.a(tmp$ret$10);
1079
- }
1080
- return tmp0_mapTo;
1081
- }
1082
- function wirespec(_this__u8e3s4, languages, packageName, path, logger) {
1083
- // Inline function 'kotlin.collections.map' call
1084
- // Inline function 'kotlin.let' call
1085
- // Inline function 'kotlin.let' call
1086
- var tmp0_let = _this__u8e3s4.q11();
1087
- var tmp1_let_this = Wirespec_getInstance();
1088
- // Inline function 'kotlin.contracts.contract' call
1089
- var tmp2_let = compile(tmp1_let_this, tmp0_let)(logger);
1090
- // Inline function 'kotlin.contracts.contract' call
1091
- // Inline function 'community.flock.wirespec.compiler.cli.wirespec.<anonymous>' call
1092
- // Inline function 'kotlin.collections.map' call
1093
- var tmp0_map = emitters(languages, packageName, path, logger);
1094
- // Inline function 'kotlin.collections.mapTo' call
1095
- var tmp0_mapTo = ArrayList_init_$Create$_0(collectionSizeOrDefault(tmp0_map, 10));
1096
- var tmp0_iterator = tmp0_map.c();
1097
- while (tmp0_iterator.d()) {
1098
- var item = tmp0_iterator.e();
1099
- var tmp$ret$6;
1100
- // Inline function 'community.flock.wirespec.compiler.cli.wirespec.<anonymous>.<anonymous>' call
1101
- var emitter = item.e3();
1102
- var file = item.f3();
1103
- var results = tmp2_let(emitter);
1104
- var tmp;
1105
- if (!emitter.h1w()) {
1106
- var tmp$ret$5;
1107
- // Inline function 'arrow.core.Either.map' call
1108
- // Inline function 'kotlin.contracts.contract' call
1109
- // Inline function 'arrow.core.flatMap' call
1110
- // Inline function 'kotlin.contracts.contract' call
1111
- var tmp_0;
1112
- if (results instanceof Right) {
1113
- // Inline function 'arrow.core.Either.map.<anonymous>' call
1114
- var tmp0_anonymous = results.w1p_1;
1115
- var tmp$ret$2;
1116
- // Inline function 'community.flock.wirespec.compiler.cli.wirespec.<anonymous>.<anonymous>.<anonymous>' call
1117
- tmp$ret$2 = listOf(new Emitted(Companion_getInstance_1().y1r(path(Extension_Wirespec_getInstance()).i3t_1), first(tmp0_anonymous).o1s_1));
1118
- tmp_0 = new Right(tmp$ret$2);
1119
- } else {
1120
- if (results instanceof Left) {
1121
- tmp_0 = results;
1122
- } else {
1123
- noWhenBranchMatchedException();
1124
- }
1125
- }
1126
- tmp$ret$5 = tmp_0;
1127
- tmp = to(tmp$ret$5, file);
1128
- } else {
1129
- tmp = to(results, file);
1130
- }
1131
- tmp$ret$6 = tmp;
1132
- tmp0_mapTo.a(tmp$ret$6);
1133
- }
1134
- // Inline function 'kotlin.collections.mapTo' call
1135
- var tmp0_mapTo_0 = ArrayList_init_$Create$_0(collectionSizeOrDefault(tmp0_mapTo, 10));
1136
- var tmp0_iterator_0 = tmp0_mapTo.c();
1137
- while (tmp0_iterator_0.d()) {
1138
- var item_0 = tmp0_iterator_0.e();
1139
- // Inline function 'community.flock.wirespec.compiler.cli.wirespec.<anonymous>' call
1140
- var results_0 = item_0.e3();
1141
- var file_0 = item_0.f3();
1142
- if (results_0 instanceof Right) {
1143
- write(results_0.w1p_1, file_0);
1144
- } else {
1145
- if (results_0 instanceof Left) {
1146
- println(results_0.r1p_1);
1147
- }
1148
- }
1149
- tmp0_mapTo_0.a(Unit_getInstance());
1150
- }
1151
- }
1152
- function compile$ref() {
1153
- var l = function (p0) {
1154
- compile_0(p0);
1155
- return Unit_getInstance();
1156
- };
1157
- l.callableName = 'compile';
1158
- return l;
1159
- }
1160
- function convert$ref() {
1161
- var l = function (p0) {
1162
- convert(p0);
1163
- return Unit_getInstance();
1164
- };
1165
- l.callableName = 'convert';
1166
- return l;
1167
- }
1168
- function compile$lambda($output) {
1169
- return function (it) {
1170
- return new FullFilePath(ensureNotNull($output), 'console', it);
1171
- };
1172
- }
1173
- function out$lambda($output, $this_out, $packageName) {
1174
- return function (extension) {
1175
- var tmp0_elvis_lhs = $output;
1176
- var tmp;
1177
- if (tmp0_elvis_lhs == null) {
1178
- var tmp$ret$1;
1179
- // Inline function 'kotlin.text.lowercase' call
1180
- var tmp0_lowercase = extension.o5_1;
1181
- var tmp$ret$0;
1182
- // Inline function 'kotlin.js.asDynamic' call
1183
- tmp$ret$0 = tmp0_lowercase;
1184
- tmp$ret$1 = tmp$ret$0.toLowerCase();
1185
- tmp = $this_out.h3t_1 + '/out/' + tmp$ret$1;
1186
- } else {
1187
- tmp = tmp0_elvis_lhs;
1188
- }
1189
- var dir = tmp;
1190
- return $this_out.l3t(dir + '/' + joinToString(split_0($packageName, charArrayOf([_Char___init__impl__6a9atx(46)])), '/'), VOID, extension);
1191
- };
1192
- }
1193
- function Format_OpenApiV2_getInstance() {
1194
- Format_initEntries();
1195
- return Format_OpenApiV2_instance;
1196
- }
1197
- function Format_OpenApiV3_getInstance() {
1198
- Format_initEntries();
1199
- return Format_OpenApiV3_instance;
1200
- }
1201
- var Extension_Java_instance;
1202
- var Extension_Kotlin_instance;
1203
- var Extension_Scala_instance;
1204
- var Extension_TypeScript_instance;
1205
- var Extension_Wirespec_instance;
1206
- var Extension_Json_instance;
1207
- function values_4() {
1208
- return [Extension_Java_getInstance(), Extension_Kotlin_getInstance(), Extension_Scala_getInstance(), Extension_TypeScript_getInstance(), Extension_Wirespec_getInstance(), Extension_Json_getInstance()];
1209
- }
1210
- function get_entries_3() {
1211
- if ($ENTRIES_3 == null)
1212
- $ENTRIES_3 = enumEntries(values_4());
1213
- return $ENTRIES_3;
1214
- }
1215
- var Extension_entriesInitialized;
1216
- function Extension_initEntries() {
1217
- if (Extension_entriesInitialized)
1218
- return Unit_getInstance();
1219
- Extension_entriesInitialized = true;
1220
- Extension_Java_instance = new Extension('Java', 0, 'java');
1221
- Extension_Kotlin_instance = new Extension('Kotlin', 1, 'kt');
1222
- Extension_Scala_instance = new Extension('Scala', 2, 'scala');
1223
- Extension_TypeScript_instance = new Extension('TypeScript', 3, 'ts');
1224
- Extension_Wirespec_instance = new Extension('Wirespec', 4, 'ws');
1225
- Extension_Json_instance = new Extension('Json', 5, 'json');
1226
- }
1227
- var $ENTRIES_3;
1228
- function Extension(name, ordinal, ext) {
1229
- Enum.call(this, name, ordinal);
1230
- this.g3t_1 = ext;
1231
- }
1232
- function Extension_Java_getInstance() {
1233
- Extension_initEntries();
1234
- return Extension_Java_instance;
1235
- }
1236
- function Extension_Kotlin_getInstance() {
1237
- Extension_initEntries();
1238
- return Extension_Kotlin_instance;
1239
- }
1240
- function Extension_Scala_getInstance() {
1241
- Extension_initEntries();
1242
- return Extension_Scala_instance;
1243
- }
1244
- function Extension_TypeScript_getInstance() {
1245
- Extension_initEntries();
1246
- return Extension_TypeScript_instance;
1247
- }
1248
- function Extension_Wirespec_getInstance() {
1249
- Extension_initEntries();
1250
- return Extension_Wirespec_instance;
1251
- }
1252
- function Extension_Json_getInstance() {
1253
- Extension_initEntries();
1254
- return Extension_Json_instance;
1255
- }
1256
- function JavaFile(path) {
1257
- File.call(this, path.l3t(VOID, VOID, Extension_Java_getInstance()));
1258
- }
1259
- protoOf(JavaFile).q3t = function (fileName) {
1260
- return new JavaFile(this.n3t_1.l3t(VOID, fileName));
1261
- };
1262
- function JsonFile(path) {
1263
- File.call(this, path.l3t(VOID, VOID, Extension_Json_getInstance()));
1264
- }
1265
- protoOf(JsonFile).q3t = function (fileName) {
1266
- return new JsonFile(this.n3t_1.l3t(VOID, fileName));
1267
- };
1268
- function KotlinFile(path) {
1269
- File.call(this, path.l3t(VOID, VOID, Extension_Kotlin_getInstance()));
1270
- }
1271
- protoOf(KotlinFile).q3t = function (fileName) {
1272
- return new KotlinFile(this.n3t_1.l3t(VOID, fileName));
1273
- };
1274
- function ScalaFile(path) {
1275
- File.call(this, path.l3t(VOID, VOID, Extension_Scala_getInstance()));
1276
- }
1277
- protoOf(ScalaFile).q3t = function (fileName) {
1278
- return new ScalaFile(this.n3t_1.l3t(VOID, fileName));
1279
- };
1280
- function TypeScriptFile(path) {
1281
- File.call(this, path.l3t(VOID, VOID, Extension_TypeScript_getInstance()));
1282
- }
1283
- protoOf(TypeScriptFile).q3t = function (fileName) {
1284
- return new TypeScriptFile(this.n3t_1.l3t(VOID, fileName));
1285
- };
1286
- function WirespecFile(path) {
1287
- File.call(this, path.l3t(VOID, VOID, Extension_Wirespec_getInstance()));
1288
- }
1289
- protoOf(WirespecFile).q3t = function (fileName) {
1290
- return new WirespecFile(this.n3t_1.l3t(VOID, fileName));
1291
- };
1292
- function Directory$wirespecFiles$lambda(it) {
1293
- // Inline function 'kotlin.js.unsafeCast' call
1294
- return it;
1295
- }
1296
- function Directory$wirespecFiles$lambda_0(it) {
1297
- return endsWith(it, Extension_Wirespec_getInstance().g3t_1);
1298
- }
1299
- function Directory$wirespecFiles$lambda_1(it) {
1300
- return dropLast_0(it, Extension_Wirespec_getInstance().g3t_1.length + 1 | 0);
1301
- }
1302
- function Directory$wirespecFiles$lambda_2(this$0) {
1303
- return function (it) {
1304
- return new FullFilePath(this$0.o3t_1, it);
1305
- };
1306
- }
1307
- function WirespecFile$_init_$ref_cj1n5j() {
1308
- var l = function (p0) {
1309
- return new WirespecFile(p0);
1310
- };
1311
- l.callableName = '<init>';
1312
- return l;
1313
- }
1314
- function Directory(path) {
1315
- this.o3t_1 = path;
1316
- }
1317
- protoOf(Directory).p3t = function () {
1318
- var tmp = asSequence(iterator(get_fs().readdirSync(this.o3t_1, 'utf-8')));
1319
- var tmp_0 = map(tmp, Directory$wirespecFiles$lambda);
1320
- var tmp_1 = filter(tmp_0, Directory$wirespecFiles$lambda_0);
1321
- var tmp_2 = map(tmp_1, Directory$wirespecFiles$lambda_1);
1322
- var tmp_3 = map(tmp_2, Directory$wirespecFiles$lambda_2(this));
1323
- return toSet_0(map(tmp_3, WirespecFile$_init_$ref_cj1n5j()));
1324
- };
1325
- function File(path) {
1326
- this.n3t_1 = path;
1327
- }
1328
- protoOf(File).q11 = function () {
1329
- // Inline function 'kotlin.js.unsafeCast' call
1330
- return get_fs().readFileSync(this.n3t_1.toString(), 'utf-8');
1331
- };
1332
- protoOf(File).r3t = function (text) {
1333
- // Inline function 'kotlin.run' call
1334
- var tmp0_run = this.n3t_1.l3t(joinToString(split(this.n3t_1.h3t_1, ['out']), 'out/node'));
1335
- // Inline function 'kotlin.contracts.contract' call
1336
- // Inline function 'community.flock.wirespec.compiler.cli.io.File.write.<anonymous>' call
1337
- // Inline function 'kotlin.js.unsafeCast' call
1338
- if (!get_fs().existsSync(tmp0_run.h3t_1)) {
1339
- get_fs().mkdirSync(tmp0_run.h3t_1, {recursive: true});
1340
- }
1341
- get_fs().writeFileSync(tmp0_run.toString(), text);
1342
- };
1343
- function get_fs() {
1344
- _init_properties_JavaScriptBindings_kt__clolet();
1345
- return fs;
1346
- }
1347
- var fs;
1348
- var properties_initialized_JavaScriptBindings_kt_6og6hv;
1349
- function _init_properties_JavaScriptBindings_kt__clolet() {
1350
- if (!properties_initialized_JavaScriptBindings_kt_6og6hv) {
1351
- properties_initialized_JavaScriptBindings_kt_6og6hv = true;
1352
- fs = require('fs');
1353
- }
1354
- }
1355
- function get_nodeArgs() {
1356
- _init_properties_CommandLineArguments_kt__b5v7hl();
1357
- return nodeArgs;
1358
- }
1359
- var nodeArgs;
1360
- function orNull(_this__u8e3s4, idx) {
1361
- _init_properties_CommandLineArguments_kt__b5v7hl();
1362
- // Inline function 'kotlin.Result.getOrNull' call
1363
- // Inline function 'kotlin.runCatching' call
1364
- var tmp;
1365
- try {
1366
- // Inline function 'kotlin.Companion.success' call
1367
- Companion_getInstance_2();
1368
- // Inline function 'community.flock.wirespec.compiler.utils.orNull.<anonymous>' call
1369
- var tmp1_success = get_nodeArgs()[idx];
1370
- tmp = _Result___init__impl__xyqfz8(tmp1_success);
1371
- } catch ($p) {
1372
- var tmp_0;
1373
- if ($p instanceof Error) {
1374
- var e = $p;
1375
- // Inline function 'kotlin.Companion.failure' call
1376
- Companion_getInstance_2();
1377
- tmp_0 = _Result___init__impl__xyqfz8(createFailure(e));
1378
- } else {
1379
- throw $p;
1380
- }
1381
- tmp = tmp_0;
1382
- }
1383
- var tmp0_getOrNull = tmp;
1384
- var tmp_1;
1385
- if (_Result___get_isFailure__impl__jpiriv(tmp0_getOrNull)) {
1386
- tmp_1 = null;
1387
- } else {
1388
- var tmp_2 = _Result___get_value__impl__bjfvqg(tmp0_getOrNull);
1389
- tmp_1 = (tmp_2 == null ? true : isObject(tmp_2)) ? tmp_2 : THROW_CCE();
1390
- }
1391
- return tmp_1;
1392
- }
1393
- var properties_initialized_CommandLineArguments_kt_ekn5uh;
1394
- function _init_properties_CommandLineArguments_kt__b5v7hl() {
1395
- if (!properties_initialized_CommandLineArguments_kt_ekn5uh) {
1396
- properties_initialized_CommandLineArguments_kt_ekn5uh = true;
1397
- var tmp = process.argv.slice(2);
1398
- nodeArgs = (!(tmp == null) ? isArray(tmp) : false) ? tmp : THROW_CCE();
1399
- }
1400
- }
1401
- //region block: exports
1402
- _.$_$ = _.$_$ || {};
1403
- _.$_$.a = main;
1404
- //endregion
1405
- return _;
1406
- }));
1407
-
1408
- //# sourceMappingURL=wirespec-src-compiler-cli.js.map