@glutinum/cli 1.0.0-beta.5 → 1.0.0-beta.7

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.
@@ -366,20 +366,21 @@ export function GlueFunctionDeclaration_$reflection() {
366
366
  }
367
367
 
368
368
  export class GlueModuleDeclaration extends Record {
369
- constructor(Documentation, Name, IsTopLevel, IsNamespace, IsGlobal, IsRecursive, Types) {
369
+ constructor(Documentation, Name, IsTopLevel, IsNamespace, IsGlobal, IsExported, IsRecursive, Types) {
370
370
  super();
371
371
  this.Documentation = Documentation;
372
372
  this.Name = Name;
373
373
  this.IsTopLevel = IsTopLevel;
374
374
  this.IsNamespace = IsNamespace;
375
375
  this.IsGlobal = IsGlobal;
376
+ this.IsExported = IsExported;
376
377
  this.IsRecursive = IsRecursive;
377
378
  this.Types = Types;
378
379
  }
379
380
  }
380
381
 
381
382
  export function GlueModuleDeclaration_$reflection() {
382
- return record_type("Glutinum.Converter.GlueAST.GlueModuleDeclaration", [], GlueModuleDeclaration, () => [["Documentation", list_type(GlueComment_$reflection())], ["Name", string_type], ["IsTopLevel", bool_type], ["IsNamespace", bool_type], ["IsGlobal", bool_type], ["IsRecursive", bool_type], ["Types", list_type(GlueType_$reflection())]]);
383
+ return record_type("Glutinum.Converter.GlueAST.GlueModuleDeclaration", [], GlueModuleDeclaration, () => [["Documentation", list_type(GlueComment_$reflection())], ["Name", string_type], ["IsTopLevel", bool_type], ["IsNamespace", bool_type], ["IsGlobal", bool_type], ["IsExported", bool_type], ["IsRecursive", bool_type], ["Types", list_type(GlueType_$reflection())]]);
383
384
  }
384
385
 
385
386
  export class GlueConstructor extends Record {
@@ -440,7 +440,7 @@ function keepIncluded(included, types) {
440
440
  return undefined;
441
441
  }
442
442
  else {
443
- return new GlueType(/* ModuleDeclaration */ 11, [new GlueModuleDeclaration(glueType.fields[0].Documentation, glueType.fields[0].Name, glueType.fields[0].IsTopLevel, glueType.fields[0].IsNamespace, glueType.fields[0].IsGlobal, glueType.fields[0].IsRecursive, matchValue_1)]);
443
+ return new GlueType(/* ModuleDeclaration */ 11, [new GlueModuleDeclaration(glueType.fields[0].Documentation, glueType.fields[0].Name, glueType.fields[0].IsTopLevel, glueType.fields[0].IsNamespace, glueType.fields[0].IsGlobal, glueType.fields[0].IsExported, glueType.fields[0].IsRecursive, matchValue_1)]);
444
444
  }
445
445
  }
446
446
  default: {
@@ -849,22 +849,43 @@ function printEnum(printer, enumInfo) {
849
849
  }
850
850
 
851
851
  function printTypeAlias(printer, aliasInfo) {
852
- const aliasedType = printType(aliasInfo.Type);
852
+ let aliasedType;
853
+ const text = printType(aliasInfo.Type);
854
+ let matchResult;
855
+ if (aliasInfo.Type.tag === 16) {
856
+ if (text.startsWith("(") && text.endsWith(")")) {
857
+ matchResult = 0;
858
+ }
859
+ else {
860
+ matchResult = 1;
861
+ }
862
+ }
863
+ else {
864
+ matchResult = 1;
865
+ }
866
+ switch (matchResult) {
867
+ case 0: {
868
+ aliasedType = substring(text, 1, text.length - 2);
869
+ break;
870
+ }
871
+ default:
872
+ aliasedType = text;
873
+ }
853
874
  const usageText = join(" ", append(singleton(aliasedType), choose((_arg) => {
854
- let matchResult, constraint_;
875
+ let matchResult_1, constraint_;
855
876
  if (_arg.tag === 1) {
856
877
  if (_arg.fields[0].Constraint != null) {
857
- matchResult = 0;
878
+ matchResult_1 = 0;
858
879
  constraint_ = _arg.fields[0].Constraint;
859
880
  }
860
881
  else {
861
- matchResult = 1;
882
+ matchResult_1 = 1;
862
883
  }
863
884
  }
864
885
  else {
865
- matchResult = 1;
886
+ matchResult_1 = 1;
866
887
  }
867
- switch (matchResult) {
888
+ switch (matchResult_1) {
868
889
  case 0:
869
890
  return printType(constraint_);
870
891
  default:
@@ -2,9 +2,9 @@
2
2
  import { ts } from "@ts-morph/bootstrap";
3
3
  import { ambientModuleSpecifier, ambientModuleNames as ambientModuleNames_1, isMergedInterfaceDeclaration, promotedAmbientModule } from "./Reader/Utils.js";
4
4
  import { FSharpSet__Contains, ofSeq } from "../fable_modules/fable-library-js.5.17.2/Set.js";
5
- import { exists, sortBy, reverse, concat, partition, ofSeq as ofSeq_1, singleton, fold, collect, append, head as head_1, tail, isEmpty, filter, map, empty as empty_1, cons, foldBack, choose } from "../fable_modules/fable-library-js.5.17.2/List.js";
5
+ import { exists, sortBy, reverse, concat, partition, ofSeq as ofSeq_1, fold, append, head as head_1, tail, isEmpty, filter, map, cons, foldBack, choose, singleton, ofArray, empty, collect } from "../fable_modules/fable-library-js.5.17.2/List.js";
6
6
  import { safeHash, stringHash, equals, comparePrimitives, compareArrays } from "../fable_modules/fable-library-js.5.17.2/Util.js";
7
- import { ofSeq as ofSeq_2, toSeq, FSharpMap__Add, fold as fold_1, empty, add, tryFind } from "../fable_modules/fable-library-js.5.17.2/Map.js";
7
+ import { ofSeq as ofSeq_2, toSeq, FSharpMap__Add, fold as fold_1, empty as empty_1, add, tryFind } from "../fable_modules/fable-library-js.5.17.2/Map.js";
8
8
  import { GlueClassDeclaration, GlueModuleDeclaration, GlueType, GlueFileModule } from "./GlueAST.js";
9
9
  import { split, substring } from "../fable_modules/fable-library-js.5.17.2/String.js";
10
10
  import { List_groupBy } from "../fable_modules/fable-library-js.5.17.2/Seq2.js";
@@ -45,12 +45,23 @@ function declarationKey(glueType) {
45
45
  }
46
46
 
47
47
  function dropShadowedReExports(types) {
48
- const localKeys = ofSeq(choose((glueType) => {
48
+ const localKeys = ofSeq(collect((glueType) => {
49
49
  if (glueType.tag === 32) {
50
- return undefined;
50
+ return empty();
51
51
  }
52
52
  else {
53
- return declarationKey(glueType);
53
+ const matchValue = declarationKey(glueType);
54
+ if (matchValue == null) {
55
+ return empty();
56
+ }
57
+ else if (matchValue[0] === "class") {
58
+ const name = matchValue[1];
59
+ return ofArray([["class", name], ["type", name], ["value", name]]);
60
+ }
61
+ else {
62
+ const key = matchValue;
63
+ return singleton(key);
64
+ }
54
65
  }
55
66
  }, types), {
56
67
  Compare: (x, y) => (compareArrays(x, y) | 0),
@@ -77,8 +88,8 @@ function dropShadowedReExports(types) {
77
88
  const acc = tupledArg[1];
78
89
  if (glueType_2.tag === 32) {
79
90
  const reExport = glueType_2.fields[0];
80
- const matchValue = declarationKey(reExport.Declaration);
81
- if (matchValue == null) {
91
+ const matchValue_1 = declarationKey(reExport.Declaration);
92
+ if (matchValue_1 == null) {
82
93
  if (FSharpSet__Contains(localNames, reExport.Name)) {
83
94
  return [seen, acc];
84
95
  }
@@ -87,18 +98,18 @@ function dropShadowedReExports(types) {
87
98
  }
88
99
  }
89
100
  else {
90
- const category = matchValue[0];
91
- const key = [category, reExport.Name];
92
- if (FSharpSet__Contains(localKeys, key)) {
101
+ const category = matchValue_1[0];
102
+ const key_1 = [category, reExport.Name];
103
+ if (FSharpSet__Contains(localKeys, key_1)) {
93
104
  return [seen, acc];
94
105
  }
95
106
  else {
96
- const matchValue_1 = tryFind(key, seen);
97
- if (matchValue_1 == null) {
98
- return [add(key, reExport.ModulePath, seen), cons(glueType_2, acc)];
107
+ const matchValue_2 = tryFind(key_1, seen);
108
+ if (matchValue_2 == null) {
109
+ return [add(key_1, reExport.ModulePath, seen), cons(glueType_2, acc)];
99
110
  }
100
- else if ((modulePath = matchValue_1, (category === "value") && equals(modulePath, reExport.ModulePath))) {
101
- const modulePath_1 = matchValue_1;
111
+ else if ((modulePath = matchValue_2, (category === "value") && equals(modulePath, reExport.ModulePath))) {
112
+ const modulePath_1 = matchValue_2;
102
113
  return [seen, cons(glueType_2, acc)];
103
114
  }
104
115
  else {
@@ -110,9 +121,9 @@ function dropShadowedReExports(types) {
110
121
  else {
111
122
  return [seen, cons(glueType_2, acc)];
112
123
  }
113
- }, types, [empty({
124
+ }, types, [empty_1({
114
125
  Compare: (x_2, y_2) => (compareArrays(x_2, y_2) | 0),
115
- }), empty_1()])[1];
126
+ }), empty()])[1];
116
127
  }
117
128
 
118
129
  function nestByName(fileModules) {
@@ -132,7 +143,7 @@ function nestByName(fileModules) {
132
143
  }
133
144
  const nested = nestByName(map((fileModule_3) => (new GlueFileModule(substring(fileModule_3.Name, head.length + 1), fileModule_3.ImportSpecifier, fileModule_3.SymbolSpecifiers, fileModule_3.IsGlobal, fileModule_3.HasRuntime, fileModule_3.Types)), filter((fileModule_2) => (fileModule_2.Name !== head), group)));
134
145
  if (ownModule == null) {
135
- return new GlueType(/* FileModule */ 31, [new GlueFileModule(head, "", empty({
146
+ return new GlueType(/* FileModule */ 31, [new GlueFileModule(head, "", empty_1({
136
147
  Compare: (x_1, y_1) => (comparePrimitives(x_1, y_1) | 0),
137
148
  }), false, false, nested)]);
138
149
  }
@@ -160,13 +171,13 @@ function extractGlobals(types) {
160
171
  }
161
172
  else {
162
173
  const patternInput = extractGlobals(glueType.fields[0].Types);
163
- return [append(remaining, singleton(new GlueType(/* ModuleDeclaration */ 11, [new GlueModuleDeclaration(glueType.fields[0].Documentation, glueType.fields[0].Name, glueType.fields[0].IsTopLevel, glueType.fields[0].IsNamespace, glueType.fields[0].IsGlobal, glueType.fields[0].IsRecursive, patternInput[0])]))), append(globals, patternInput[1])];
174
+ return [append(remaining, singleton(new GlueType(/* ModuleDeclaration */ 11, [new GlueModuleDeclaration(glueType.fields[0].Documentation, glueType.fields[0].Name, glueType.fields[0].IsTopLevel, glueType.fields[0].IsNamespace, glueType.fields[0].IsGlobal, glueType.fields[0].IsExported, glueType.fields[0].IsRecursive, patternInput[0])]))), append(globals, patternInput[1])];
164
175
  }
165
176
  }
166
177
  else {
167
178
  return [append(remaining, singleton(glueType)), globals];
168
179
  }
169
- }, [empty_1(), empty_1()], types);
180
+ }, [empty(), empty()], types);
170
181
  }
171
182
 
172
183
  function readStatements(reader, sourceFile) {
@@ -204,7 +215,7 @@ function readStatements(reader, sourceFile) {
204
215
  case 0:
205
216
  return reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadExportDeclarationEF24BD1"](statement);
206
217
  case 1:
207
- return empty_1();
218
+ return empty();
208
219
  case 2: {
209
220
  const matchValue_1 = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadNode6C0FD055"](statement);
210
221
  if (matchValue_1.tag === 11) {
@@ -271,8 +282,8 @@ function nestAmbientModules(packageContext, package$, fileName, types) {
271
282
  GetHashCode: (x) => (safeHash(x) | 0),
272
283
  })));
273
284
  const own = patternInput_2[0];
274
- const patternInput_3 = !isEmpty(own) ? (isEmpty(tail(own)) ? [head_1(own)[2], head_1(own)[1]] : [empty_1(), undefined]) : [empty_1(), undefined];
275
- return [patternInput[1], append(patternInput_3[0], concat(map((tupledArg_4) => fold((types_3, segment) => singleton(new GlueType(/* FileModule */ 31, [new GlueFileModule(segment, tupledArg_4[1], empty({
285
+ const patternInput_3 = !isEmpty(own) ? (isEmpty(tail(own)) ? [head_1(own)[2], head_1(own)[1]] : [empty(), undefined]) : [empty(), undefined];
286
+ return [patternInput[1], append(patternInput_3[0], concat(map((tupledArg_4) => fold((types_3, segment) => singleton(new GlueType(/* FileModule */ 31, [new GlueFileModule(segment, tupledArg_4[1], empty_1({
276
287
  Compare: (x_1, y_1) => (comparePrimitives(x_1, y_1) | 0),
277
288
  }), false, package$.HasRuntime, types_3)])), tupledArg_4[2], reverse(tupledArg_4[0])), patternInput_2[1]))), patternInput_3[1]];
278
289
  }
@@ -292,56 +303,8 @@ export function readPackages(checker, packageContext, sourceFiles) {
292
303
  const unexported = [];
293
304
  const hoistedSpecifiers = [];
294
305
  const hoistedTypes = [];
295
- const withoutValues = (types) => choose((_arg) => {
296
- let matchResult, info, info_1, glueType;
297
- switch (_arg.tag) {
298
- case 6:
299
- case 2: {
300
- matchResult = 1;
301
- break;
302
- }
303
- case 12: {
304
- matchResult = 0;
305
- info = _arg.fields[0];
306
- break;
307
- }
308
- case 25: {
309
- switch (_arg.fields[0].tag) {
310
- case 6:
311
- case 2: {
312
- matchResult = 1;
313
- break;
314
- }
315
- default: {
316
- matchResult = 3;
317
- glueType = _arg;
318
- }
319
- }
320
- break;
321
- }
322
- case 11: {
323
- matchResult = 2;
324
- info_1 = _arg.fields[0];
325
- break;
326
- }
327
- default: {
328
- matchResult = 3;
329
- glueType = _arg;
330
- }
331
- }
332
- switch (matchResult) {
333
- case 0:
334
- return new GlueType(/* ClassDeclaration */ 12, [new GlueClassDeclaration(info.Documentation, info.FullName, info.Name, info.Constructors, info.Members, info.TypeParameters, info.HeritageClauses, false)]);
335
- case 1:
336
- return undefined;
337
- case 2:
338
- return new GlueType(/* ModuleDeclaration */ 11, [new GlueModuleDeclaration(info_1.Documentation, info_1.Name, info_1.IsTopLevel, info_1.IsNamespace, info_1.IsGlobal, info_1.IsRecursive, withoutValues(info_1.Types))]);
339
- default:
340
- return glueType;
341
- }
342
- }, types);
343
- const patternInput_4 = partition((_arg_2) => {
344
- if (_arg_2.tag === 1) {
306
+ const patternInput_4 = partition((_arg_1) => {
307
+ if (_arg_1.tag === 1) {
345
308
  return false;
346
309
  }
347
310
  else {
@@ -351,7 +314,7 @@ export function readPackages(checker, packageContext, sourceFiles) {
351
314
  let specifier, isUnexported;
352
315
  const fileName_1 = normalizePath(sourceFile_3.fileName);
353
316
  const patternInput = extractGlobals(readStatements(reader, sourceFile_3));
354
- const types_3 = patternInput[0];
317
+ const types_2 = patternInput[0];
355
318
  addRangeInPlace(patternInput[1], globals);
356
319
  let promotedSpecifier;
357
320
  const option_1 = promotedAmbientModule(sourceFile_3);
@@ -359,35 +322,35 @@ export function readPackages(checker, packageContext, sourceFiles) {
359
322
  const moduleName = PackageContext__FileModuleName_Z11793CAF(packageContext, package$_1, fileName_1);
360
323
  let patternInput_2;
361
324
  if (ts.isExternalModule(sourceFile_3)) {
362
- patternInput_2 = [empty_1(), types_3, undefined];
325
+ patternInput_2 = [empty(), types_2, undefined];
363
326
  }
364
327
  else if (isScript(sourceFile_3)) {
365
- patternInput_2 = nestAmbientModules(packageContext, package$_1, fileName_1, types_3);
328
+ patternInput_2 = nestAmbientModules(packageContext, package$_1, fileName_1, types_2);
366
329
  }
367
330
  else {
368
- const patternInput_1 = nestAmbientModules(packageContext, package$_1, fileName_1, types_3);
369
- patternInput_2 = [empty_1(), append(patternInput_1[0], patternInput_1[1]), patternInput_1[2]];
331
+ const patternInput_1 = nestAmbientModules(packageContext, package$_1, fileName_1, types_2);
332
+ patternInput_2 = [empty(), append(patternInput_1[0], patternInput_1[1]), patternInput_1[2]];
370
333
  }
371
- const types_4 = patternInput_2[1];
334
+ const types_3 = patternInput_2[1];
372
335
  const scriptGlobals = patternInput_2[0];
373
336
  const ownSpecifier_1 = patternInput_2[2];
374
337
  const importSpecifier = (promotedSpecifier == null) ? ((ownSpecifier_1 == null) ? PackageContext__ImportSpecifier_Z721C83C5(packageContext, fileName_1) : ((specifier = ownSpecifier_1, specifier))) : ((specifier = promotedSpecifier, specifier));
375
- const fileModule = (types_5) => (new FSharpChoice$2(/* Choice2Of2 */ 1, [new GlueType(/* FileModule */ 31, [new GlueFileModule(moduleName, importSpecifier, PackageContext__SymbolSpecifiers_Z721C83C5(packageContext, fileName_1), false, package$_1.HasRuntime, types_5)])]));
338
+ const fileModule = (types_4) => (new FSharpChoice$2(/* Choice2Of2 */ 1, [new GlueType(/* FileModule */ 31, [new GlueFileModule(moduleName, importSpecifier, PackageContext__SymbolSpecifiers_Z721C83C5(packageContext, fileName_1), false, package$_1.HasRuntime, types_4)])]));
376
339
  if (fileName_1 === package$_1.EntryFile) {
377
- return new FSharpChoice$2(/* Choice1Of2 */ 0, [[append(scriptGlobals, types_4), isScript(sourceFile_3)]]);
340
+ return new FSharpChoice$2(/* Choice1Of2 */ 0, [[append(scriptGlobals, types_3), isScript(sourceFile_3)]]);
378
341
  }
379
342
  else if (isScript(sourceFile_3)) {
380
343
  addRangeInPlace(scriptGlobals, globals);
381
- if (isEmpty(types_4)) {
344
+ if (isEmpty(types_3)) {
382
345
  return undefined;
383
346
  }
384
347
  else {
385
- return fileModule(types_4);
348
+ return fileModule(types_3);
386
349
  }
387
350
  }
388
351
  else {
389
- const patternInput_3 = partition((glueType_2) => {
390
- const matchValue_2 = declarationKey((glueType_2.tag === 25) ? glueType_2.fields[0] : glueType_2);
352
+ const patternInput_3 = partition((glueType_1) => {
353
+ const matchValue_2 = declarationKey((glueType_1.tag === 25) ? glueType_1.fields[0] : glueType_1);
391
354
  if (matchValue_2 == null) {
392
355
  return false;
393
356
  }
@@ -402,71 +365,71 @@ export function readPackages(checker, packageContext, sourceFiles) {
402
365
  void (unexported.push(name));
403
366
  return true;
404
367
  }
405
- }), choose((_arg_1) => {
406
- let info_8;
407
- let matchResult_1, info_5, info_6, info_7;
408
- switch (_arg_1.tag) {
368
+ }), choose((_arg) => {
369
+ let info_6;
370
+ let matchResult, info_3, info_4, info_5;
371
+ switch (_arg.tag) {
409
372
  case 12: {
410
- if (isUnexported(_arg_1.fields[0].Name)) {
411
- matchResult_1 = 0;
412
- info_5 = _arg_1.fields[0];
373
+ if (isUnexported(_arg.fields[0].Name)) {
374
+ matchResult = 0;
375
+ info_3 = _arg.fields[0];
413
376
  }
414
377
  else {
415
- matchResult_1 = 4;
378
+ matchResult = 4;
416
379
  }
417
380
  break;
418
381
  }
419
382
  case 6: {
420
- if (isUnexported(_arg_1.fields[0].Name)) {
421
- matchResult_1 = 1;
422
- info_6 = _arg_1.fields[0];
383
+ if (isUnexported(_arg.fields[0].Name)) {
384
+ matchResult = 1;
385
+ info_4 = _arg.fields[0];
423
386
  }
424
387
  else {
425
- matchResult_1 = 4;
388
+ matchResult = 4;
426
389
  }
427
390
  break;
428
391
  }
429
392
  case 2: {
430
- if (isUnexported(_arg_1.fields[0].Name)) {
431
- matchResult_1 = 2;
432
- info_7 = _arg_1.fields[0];
393
+ if (isUnexported(_arg.fields[0].Name)) {
394
+ matchResult = 2;
395
+ info_5 = _arg.fields[0];
433
396
  }
434
397
  else {
435
- matchResult_1 = 4;
398
+ matchResult = 4;
436
399
  }
437
400
  break;
438
401
  }
439
402
  case 25: {
440
- switch (_arg_1.fields[0].tag) {
403
+ switch (_arg.fields[0].tag) {
441
404
  case 6: {
442
405
  if (isUnexported("default")) {
443
- matchResult_1 = 3;
406
+ matchResult = 3;
444
407
  }
445
408
  else {
446
- matchResult_1 = 4;
409
+ matchResult = 4;
447
410
  }
448
411
  break;
449
412
  }
450
413
  case 2: {
451
414
  if (isUnexported("default")) {
452
- matchResult_1 = 3;
415
+ matchResult = 3;
453
416
  }
454
417
  else {
455
- matchResult_1 = 4;
418
+ matchResult = 4;
456
419
  }
457
420
  break;
458
421
  }
459
422
  default:
460
- matchResult_1 = 4;
423
+ matchResult = 4;
461
424
  }
462
425
  break;
463
426
  }
464
427
  default:
465
- matchResult_1 = 4;
428
+ matchResult = 4;
466
429
  }
467
- switch (matchResult_1) {
430
+ switch (matchResult) {
468
431
  case 0:
469
- return new GlueType(/* ClassDeclaration */ 12, [new GlueClassDeclaration(info_5.Documentation, info_5.FullName, info_5.Name, info_5.Constructors, info_5.Members, info_5.TypeParameters, info_5.HeritageClauses, false)]);
432
+ return new GlueType(/* ClassDeclaration */ 12, [new GlueClassDeclaration(info_3.Documentation, info_3.FullName, info_3.Name, info_3.Constructors, info_3.Members, info_3.TypeParameters, info_3.HeritageClauses, false)]);
470
433
  case 1:
471
434
  return undefined;
472
435
  case 2:
@@ -474,30 +437,30 @@ export function readPackages(checker, packageContext, sourceFiles) {
474
437
  case 3:
475
438
  return undefined;
476
439
  default: {
477
- let matchResult_2, info_9, glueType_1;
478
- if (_arg_1.tag === 11) {
479
- if ((info_8 = _arg_1.fields[0], (!info_8.IsGlobal && !(info_8.Name.startsWith("\"") ? true : info_8.Name.startsWith("\'"))) && isUnexported(info_8.Name))) {
480
- matchResult_2 = 0;
481
- info_9 = _arg_1.fields[0];
440
+ let matchResult_1, info_7, glueType;
441
+ if (_arg.tag === 11) {
442
+ if ((info_6 = _arg.fields[0], (!info_6.IsGlobal && !(info_6.Name.startsWith("\"") ? true : info_6.Name.startsWith("\'"))) && isUnexported(info_6.Name))) {
443
+ matchResult_1 = 0;
444
+ info_7 = _arg.fields[0];
482
445
  }
483
446
  else {
484
- matchResult_2 = 1;
485
- glueType_1 = _arg_1;
447
+ matchResult_1 = 1;
448
+ glueType = _arg;
486
449
  }
487
450
  }
488
451
  else {
489
- matchResult_2 = 1;
490
- glueType_1 = _arg_1;
452
+ matchResult_1 = 1;
453
+ glueType = _arg;
491
454
  }
492
- switch (matchResult_2) {
455
+ switch (matchResult_1) {
493
456
  case 0:
494
- return new GlueType(/* ModuleDeclaration */ 11, [new GlueModuleDeclaration(info_9.Documentation, info_9.Name, info_9.IsTopLevel, info_9.IsNamespace, info_9.IsGlobal, info_9.IsRecursive, withoutValues(info_9.Types))]);
457
+ return new GlueType(/* ModuleDeclaration */ 11, [new GlueModuleDeclaration(info_7.Documentation, info_7.Name, info_7.IsTopLevel, info_7.IsNamespace, info_7.IsGlobal, false, info_7.IsRecursive, info_7.Types)]);
495
458
  default:
496
- return glueType_1;
459
+ return glueType;
497
460
  }
498
461
  }
499
462
  }
500
- }, types_4)));
463
+ }, types_3)));
501
464
  const kept = patternInput_3[1];
502
465
  const hoisted = patternInput_3[0];
503
466
  if (!isEmpty(hoisted)) {
@@ -532,44 +495,44 @@ export function readPackages(checker, packageContext, sourceFiles) {
532
495
  Compare: (x_1, y_1) => (comparePrimitives(x_1, y_1) | 0),
533
496
  }))));
534
497
  const entryTypes = patternInput_4[0];
535
- const entryIsGlobal = exists((_arg_3) => {
536
- if (_arg_3.tag === 1) {
498
+ const entryIsGlobal = exists((_arg_2) => {
499
+ if (_arg_2.tag === 1) {
537
500
  return false;
538
501
  }
539
502
  else {
540
- return _arg_3.fields[0][1];
503
+ return _arg_2.fields[0][1];
541
504
  }
542
505
  }, entryTypes);
543
- const entryTypes_1 = dropShadowedReExports(append(collect((_arg_4) => {
544
- if (_arg_4.tag === 1) {
545
- return empty_1();
506
+ const entryTypes_1 = dropShadowedReExports(append(collect((_arg_3) => {
507
+ if (_arg_3.tag === 1) {
508
+ return empty();
546
509
  }
547
510
  else {
548
- return _arg_4.fields[0][0];
511
+ return _arg_3.fields[0][0];
549
512
  }
550
513
  }, entryTypes), ofSeq_1(hoistedTypes)));
551
- const fileModules_2 = nestByName(choose((_arg_5) => {
552
- let matchResult_3, fileModule_1;
553
- if (_arg_5.tag === 1) {
554
- if (_arg_5.fields[0].tag === 31) {
555
- matchResult_3 = 0;
556
- fileModule_1 = _arg_5.fields[0].fields[0];
514
+ const fileModules_2 = nestByName(choose((_arg_4) => {
515
+ let matchResult_2, fileModule_1;
516
+ if (_arg_4.tag === 1) {
517
+ if (_arg_4.fields[0].tag === 31) {
518
+ matchResult_2 = 0;
519
+ fileModule_1 = _arg_4.fields[0].fields[0];
557
520
  }
558
521
  else {
559
- matchResult_3 = 1;
522
+ matchResult_2 = 1;
560
523
  }
561
524
  }
562
525
  else {
563
- matchResult_3 = 1;
526
+ matchResult_2 = 1;
564
527
  }
565
- switch (matchResult_3) {
528
+ switch (matchResult_2) {
566
529
  case 0:
567
530
  return fileModule_1;
568
531
  default:
569
532
  return undefined;
570
533
  }
571
534
  }, patternInput_4[1]));
572
- const globalsModule = (globals.length === 0) ? empty_1() : singleton(new GlueType(/* ModuleDeclaration */ 11, [new GlueModuleDeclaration(empty_1(), "global", false, false, true, false, ofSeq_1(globals))]));
535
+ const globalsModule = (globals.length === 0) ? empty() : singleton(new GlueType(/* ModuleDeclaration */ 11, [new GlueModuleDeclaration(empty(), "global", false, false, true, true, false, ofSeq_1(globals))]));
573
536
  if (unexported.length > 0) {
574
537
  void (reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_Warnings"]().push(`${package$_1.RuntimeName}: ${unexported.length} declarations are not exported by any entry, they are generated as types only`));
575
538
  }
@@ -1,13 +1,31 @@
1
1
 
2
2
  import { choose, concat, toList, exists } from "../../fable_modules/fable-library-js.5.17.2/Seq.js";
3
- import { ofSeq, filter, map, singleton } from "../../fable_modules/fable-library-js.5.17.2/List.js";
4
- import { isGlobalAugmentation, isTopLevelModuleDeclaration, isMergedInterfaceDeclaration } from "./Utils.js";
3
+ import { isExportedDeclaration, isGlobalAugmentation, isTopLevelModuleDeclaration, isMergedInterfaceDeclaration, identifierText } from "./Utils.js";
4
+ import { ofSeq, filter, empty, map, collect, singleton } from "../../fable_modules/fable-library-js.5.17.2/List.js";
5
+ import { singleton as singleton_1 } from "../../fable_modules/fable-library-js.5.17.2/Set.js";
6
+ import { comparePrimitives } from "../../fable_modules/fable-library-js.5.17.2/Util.js";
5
7
  import { GlueModuleDeclaration } from "../GlueAST.js";
6
8
 
7
9
  export function readModuleDeclaration(reader, declaration) {
8
10
  const name = declaration.name;
9
11
  const children = declaration.getChildren();
10
- const isNamespace = ((declaration.parent.kind === 268) && (declaration.parent.body === declaration)) ? true : exists((node) => (node.kind === 145), children);
12
+ const isBodyOfDottedName = (declaration.parent.kind === 268) && (declaration.parent.body === declaration);
13
+ const isNamespace = isBodyOfDottedName ? true : exists((node) => (node.kind === 145), children);
14
+ const isAmbientModule = declaration.name.kind === 11;
15
+ const isExportAssigned = exists((statement) => {
16
+ if (statement.kind === 278) {
17
+ const expression = statement.expression;
18
+ if (expression.kind === 80) {
19
+ return identifierText(expression) === name.getText();
20
+ }
21
+ else {
22
+ return false;
23
+ }
24
+ }
25
+ else {
26
+ return false;
27
+ }
28
+ }, declaration.getSourceFile().statements);
11
29
  const types = toList(concat(choose((child) => {
12
30
  const matchValue = child.kind;
13
31
  switch (matchValue) {
@@ -15,12 +33,42 @@ export function readModuleDeclaration(reader, declaration) {
15
33
  return singleton(reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadNode6C0FD055"](child));
16
34
  case 269: {
17
35
  const moduleBlock = child;
18
- return map((node_1) => reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadNode6C0FD055"](node_1), filter((statement) => !isMergedInterfaceDeclaration(reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"](), reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_PackageContext"](), statement), ofSeq(moduleBlock.statements)));
36
+ return collect((statement_2) => {
37
+ let exportClause;
38
+ if (statement_2.kind === 279) {
39
+ const exportDeclaration = statement_2;
40
+ const matchValue_2 = exportDeclaration.exportClause;
41
+ let matchResult, exportClause_1;
42
+ if (matchValue_2 != null) {
43
+ if ((exportClause = matchValue_2, (exportDeclaration.moduleSpecifier == null) && (exportClause.kind === 280))) {
44
+ matchResult = 0;
45
+ exportClause_1 = matchValue_2;
46
+ }
47
+ else {
48
+ matchResult = 1;
49
+ }
50
+ }
51
+ else {
52
+ matchResult = 1;
53
+ }
54
+ switch (matchResult) {
55
+ case 0:
56
+ return map((node_1) => reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadNode6C0FD055"](node_1), toList(exportClause_1.elements));
57
+ default:
58
+ return empty();
59
+ }
60
+ }
61
+ else {
62
+ return singleton(reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadNode6C0FD055"](statement_2));
63
+ }
64
+ }, filter((statement_1) => !isMergedInterfaceDeclaration(reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"](), reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_PackageContext"](), statement_1), ofSeq(moduleBlock.statements)));
19
65
  }
20
66
  default:
21
67
  return undefined;
22
68
  }
23
69
  }, children)));
24
- return new GlueModuleDeclaration(reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadDocumentationFromNode6C0FD055"](declaration), name.getText(), isTopLevelModuleDeclaration(reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_PackageContext"](), declaration), isNamespace, (reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_PackageContext"]() != null) && isGlobalAugmentation(declaration), false, types);
70
+ return new GlueModuleDeclaration(reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadDocumentationFromNode6C0FD055"](declaration), name.getText(), isTopLevelModuleDeclaration(reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_PackageContext"](), declaration), isNamespace, (reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_PackageContext"]() != null) && isGlobalAugmentation(declaration), ((isAmbientModule ? true : isBodyOfDottedName) ? true : isExportAssigned) ? true : isExportedDeclaration(declaration, singleton_1(name.getText(), {
71
+ Compare: (x, y) => (comparePrimitives(x, y) | 0),
72
+ })), false, types);
25
73
  }
26
74
 
@@ -9,7 +9,7 @@ import { concat } from "../../fable_modules/fable-library-js.5.17.2/String.js";
9
9
  import { TypeScript_Ts_SyntaxKind__SyntaxKind_get_Name } from "../TypeScript.Extensions.js";
10
10
 
11
11
  export function readNode(reader, node) {
12
- let option_3, option, binder, checker, option_1, target, matchValue_1, declarations, declarations_1, declaration, matchValue_2;
12
+ let option_3, option, binder, checker, option_1, target, matchValue_1, declarations, declarations_1, declaration, declaration_1, matchValue_2;
13
13
  const matchValue = node.kind;
14
14
  switch (matchValue) {
15
15
  case 136:
@@ -44,10 +44,10 @@ export function readNode(reader, node) {
44
44
  return reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadExportAssignmentZ3497D0FE"](node);
45
45
  case 282: {
46
46
  const exportSpecifier = node;
47
- return defaultArg((option_3 = ((option = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"]().getExportSpecifierLocalTargetSymbol(exportSpecifier), (binder = ((checker = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"](), (symbol) => resolveAlias(checker, symbol))), (option_1 = option, (option_1 != null) ? binder(option_1) : undefined)))), (option_3 != null) ? ((target = option_3, (matchValue_1 = target.declarations, (matchValue_1 != null) ? (((declarations = matchValue_1, declarations.length > 0)) ? ((declarations_1 = matchValue_1, (declaration = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadNode6C0FD055"](item(0, declarations_1)), (matchValue_2 = exportSpecifier.propertyName, (matchValue_2 == null) ? declaration : (new GlueType(/* ReExport */ 32, [new GlueReExport(moduleExportNameText(exportSpecifier.name), declaration, empty())])))))) : undefined) : undefined))) : undefined), GlueType.Discard);
47
+ return defaultArg((option_3 = ((option = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"]().getExportSpecifierLocalTargetSymbol(exportSpecifier), (binder = ((checker = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"](), (symbol) => resolveAlias(checker, symbol))), (option_1 = option, (option_1 != null) ? binder(option_1) : undefined)))), (option_3 != null) ? ((target = option_3, (matchValue_1 = target.declarations, (matchValue_1 != null) ? (((declarations = matchValue_1, declarations.length > 0)) ? ((declarations_1 = matchValue_1, (declaration = item(0, declarations_1), (declaration_1 = ((declaration.kind === 261) ? reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadNode6C0FD055"](declaration.parent.parent) : reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadNode6C0FD055"](declaration)), (matchValue_2 = exportSpecifier.propertyName, (matchValue_2 == null) ? declaration_1 : (new GlueType(/* ReExport */ 32, [new GlueReExport(moduleExportNameText(exportSpecifier.name), declaration_1, empty())]))))))) : undefined) : undefined))) : undefined), GlueType.Discard);
48
48
  }
49
49
  default: {
50
- const warning = Report_readerError_Z19516DCE("node", concat("Unsupported node kind ", TypeScript_Ts_SyntaxKind__SyntaxKind_get_Name(matchValue)), node, "/_//src/Glutinum.Converter/Reader/Node.fs", 76);
50
+ const warning = Report_readerError_Z19516DCE("node", concat("Unsupported node kind ", TypeScript_Ts_SyntaxKind__SyntaxKind_get_Name(matchValue)), node, "/_//src/Glutinum.Converter/Reader/Node.fs", 83);
51
51
  void (reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_Warnings"]().push(warning));
52
52
  return GlueType.Discard;
53
53
  }