@glutinum/cli 0.14.1 → 1.0.0-beta.2

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.
Files changed (39) hide show
  1. package/dist/Glutinum.Converter/FsharpAST.js +38 -4
  2. package/dist/Glutinum.Converter/Generate.js +19 -11
  3. package/dist/Glutinum.Converter/GlueAST.js +45 -36
  4. package/dist/Glutinum.Converter/Hosting.js +917 -0
  5. package/dist/Glutinum.Converter/Merge.js +218 -82
  6. package/dist/Glutinum.Converter/Packages.js +44 -8
  7. package/dist/Glutinum.Converter/Printer.js +116 -50
  8. package/dist/Glutinum.Converter/Read.js +8 -8
  9. package/dist/Glutinum.Converter/Reader/ClassDeclaration.js +7 -7
  10. package/dist/Glutinum.Converter/Reader/Declaration.js +26 -26
  11. package/dist/Glutinum.Converter/Reader/Documentation.js +37 -36
  12. package/dist/Glutinum.Converter/Reader/ExportAssignment.js +5 -5
  13. package/dist/Glutinum.Converter/Reader/ExportDeclaration.js +31 -19
  14. package/dist/Glutinum.Converter/Reader/FunctionDeclaration.js +6 -7
  15. package/dist/Glutinum.Converter/Reader/IndexedAccessType.js +36 -29
  16. package/dist/Glutinum.Converter/Reader/InterfaceDeclaration.js +3 -3
  17. package/dist/Glutinum.Converter/Reader/MappedTypeNode.js +82 -4
  18. package/dist/Glutinum.Converter/Reader/ModuleDeclaration.js +3 -3
  19. package/dist/Glutinum.Converter/Reader/Node.js +20 -20
  20. package/dist/Glutinum.Converter/Reader/Parameters.js +7 -7
  21. package/dist/Glutinum.Converter/Reader/TypeAliasDeclaration.js +5 -5
  22. package/dist/Glutinum.Converter/Reader/TypeNode.js +291 -232
  23. package/dist/Glutinum.Converter/Reader/TypeOperatorNode.js +8 -8
  24. package/dist/Glutinum.Converter/Reader/TypeQueryNode.js +108 -40
  25. package/dist/Glutinum.Converter/Reader/TypeScriptReader.js +2 -2
  26. package/dist/Glutinum.Converter/Reader/Types.js +6 -6
  27. package/dist/Glutinum.Converter/Reader/UnionTypeNode.js +7 -6
  28. package/dist/Glutinum.Converter/Reader/Utils.js +106 -56
  29. package/dist/Glutinum.Converter/Transform.js +2137 -735
  30. package/dist/Glutinum.Converter/TypeScript.Extensions.js +194 -202
  31. package/dist/Glutinum.Converter/Utils/Naming.js +7 -0
  32. package/dist/Glutinum.Converter/Utils/String.js +2 -2
  33. package/dist/Program.js +99 -232
  34. package/package.json +4 -3
  35. package/dist/Glutinum.Converter/TypeScript.js +0 -12
  36. package/src/Glutinum.Converter/js/bootstrap.js +0 -123
  37. package/src/Glutinum.Converter/js/host.js +0 -144
  38. package/src/Glutinum.Converter/js/npm.js +0 -137
  39. package/src/Glutinum.Converter/js/resolve.js +0 -402
@@ -1,13 +1,13 @@
1
1
 
2
2
  import { Exception, safeHash, equals, compareArrays, arrayHash, equalArrays, defaultOf, comparePrimitives, int32ToString, disposeSafe, getEnumerator } from "../fable_modules/fable-library-js.5.17.2/Util.js";
3
- import { ofSeq as ofSeq_1, maxBy, ofArray, empty, collect, indexed, sortBy, head, filter, forAll, exists, zip, length, map, choose, singleton, append, isEmpty as isEmpty_1 } from "../fable_modules/fable-library-js.5.17.2/List.js";
3
+ import { ofSeq as ofSeq_1, maxBy, skip, take, forAll2, ofArray, indexed, sortBy, exists, forAll, filter, empty as empty_1, collect, head, tail, zip, length, map, choose, singleton, append, isEmpty as isEmpty_1 } from "../fable_modules/fable-library-js.5.17.2/List.js";
4
4
  import { concat, join } from "../fable_modules/fable-library-js.5.17.2/String.js";
5
5
  import { FSharpClass, FSharpModule, FSharpInterface, FSharpStaticMemberInfo, FSharpMember, FSharpMemberInfo, FSharpUnion, FSharpUnionCase, FSharpFunctionType, FSharpParameter, FSharpJSApi, FSharpTypeReference, FSharpType } from "./FsharpAST.js";
6
6
  import { ofList, tryFind } from "../fable_modules/fable-library-js.5.17.2/Map.js";
7
7
  import { addToDict, addToSet, tryGetValue, getItemFromDict } from "../fable_modules/fable-library-js.5.17.2/MapUtil.js";
8
8
  import { value } from "../fable_modules/fable-library-js.5.17.2/Option.js";
9
+ import { FSharpSet__get_IsEmpty, ofSeq, empty, FSharpSet__Contains } from "../fable_modules/fable-library-js.5.17.2/Set.js";
9
10
  import { FSharpRef } from "../fable_modules/fable-library-js.5.17.2/Types.js";
10
- import { FSharpSet__Contains, FSharpSet__get_IsEmpty, ofSeq } from "../fable_modules/fable-library-js.5.17.2/Set.js";
11
11
  import { List_distinctBy, List_distinct, List_groupBy } from "../fable_modules/fable-library-js.5.17.2/Seq2.js";
12
12
  import { FSharpChoice$3 } from "../fable_modules/fable-library-js.5.17.2/Choice.js";
13
13
  import { contains, setItem, item } from "../fable_modules/fable-library-js.5.17.2/Array.js";
@@ -141,7 +141,7 @@ function signatureTypeAt(depth, typ) {
141
141
  let signatureType_1;
142
142
  const depth_1 = (depth + 1) | 0;
143
143
  signatureType_1 = ((typ_1) => signatureTypeAt(depth_1, typ_1));
144
- let matchResult, typeReference_2, typeReference_3, typeReference_4, typ_2, typ_3, typ_4, types, functionType, typ_5;
144
+ let matchResult, typeReference_2, typeReference_3, typeArgument, typeReference_4, typ_2, typ_3, typ_4, unionInfo, types, functionType, typ_7;
145
145
  switch (typ.tag) {
146
146
  case 11: {
147
147
  if ((typeReference = typ.fields[0], ((depth < 8) && isEmpty_1(typeReference.TypeArguments)) && (aliasTargets.has(join(".", append(typeReference.ModulePath, singleton(typeReference.Name)))) ? true : (isEmpty_1(typeReference.ModulePath) && aliasTargets.has(typeReference.Name))))) {
@@ -152,50 +152,71 @@ function signatureTypeAt(depth, typ) {
152
152
  matchResult = 1;
153
153
  typeReference_3 = typ.fields[0];
154
154
  }
155
+ else if (typ.fields[0].Name === "ResizeArray") {
156
+ if (!isEmpty_1(typ.fields[0].TypeArguments)) {
157
+ if (isEmpty_1(tail(typ.fields[0].TypeArguments))) {
158
+ matchResult = 2;
159
+ typeArgument = head(typ.fields[0].TypeArguments);
160
+ }
161
+ else {
162
+ matchResult = 3;
163
+ typeReference_4 = typ.fields[0];
164
+ }
165
+ }
166
+ else {
167
+ matchResult = 3;
168
+ typeReference_4 = typ.fields[0];
169
+ }
170
+ }
155
171
  else {
156
- matchResult = 2;
172
+ matchResult = 3;
157
173
  typeReference_4 = typ.fields[0];
158
174
  }
159
175
  break;
160
176
  }
161
177
  case 3: {
162
- matchResult = 3;
178
+ matchResult = 4;
163
179
  typ_2 = typ.fields[0];
164
180
  break;
165
181
  }
166
182
  case 14: {
167
- matchResult = 4;
183
+ matchResult = 5;
168
184
  typ_3 = typ.fields[0];
169
185
  break;
170
186
  }
171
187
  case 19: {
172
- matchResult = 5;
188
+ matchResult = 6;
173
189
  typ_4 = typ.fields[0].fields[0];
174
190
  break;
175
191
  }
192
+ case 1: {
193
+ matchResult = 7;
194
+ unionInfo = typ.fields[0];
195
+ break;
196
+ }
176
197
  case 12: {
177
- matchResult = 6;
198
+ matchResult = 8;
178
199
  types = typ.fields[0];
179
200
  break;
180
201
  }
181
202
  case 16: {
182
- matchResult = 7;
203
+ matchResult = 9;
183
204
  functionType = typ.fields[0];
184
205
  break;
185
206
  }
186
207
  case 8: {
187
208
  if (typ.fields[0].tag === 6) {
188
- matchResult = 8;
209
+ matchResult = 10;
189
210
  }
190
211
  else {
191
- matchResult = 9;
192
- typ_5 = typ;
212
+ matchResult = 11;
213
+ typ_7 = typ;
193
214
  }
194
215
  break;
195
216
  }
196
217
  default: {
197
- matchResult = 9;
198
- typ_5 = typ;
218
+ matchResult = 11;
219
+ typ_7 = typ;
199
220
  }
200
221
  }
201
222
  switch (matchResult) {
@@ -206,21 +227,34 @@ function signatureTypeAt(depth, typ) {
206
227
  case 1:
207
228
  return signatureType_1(value(tryGenericAliasTarget(typeReference_3)));
208
229
  case 2:
209
- return new FSharpType(/* TypeReference */ 11, [new FSharpTypeReference((typeReference_4.Name === "JS.Uint8ClampedArray") ? "JS.Uint8Array" : typeReference_4.Name, "", typeReference_4.ModulePath, map(signatureType_1, typeReference_4.TypeArguments), FSharpType.Discard)]);
230
+ return new FSharpType(/* ResizeArray */ 14, [signatureType_1(typeArgument)]);
210
231
  case 3:
211
- return new FSharpType(/* Option */ 3, [signatureType_1(typ_2)]);
232
+ return new FSharpType(/* TypeReference */ 11, [new FSharpTypeReference((typeReference_4.Name === "JS.Uint8ClampedArray") ? "JS.Uint8Array" : typeReference_4.Name, "", typeReference_4.ModulePath, map(signatureType_1, typeReference_4.TypeArguments), FSharpType.Discard)]);
212
233
  case 4:
213
- return new FSharpType(/* ResizeArray */ 14, [signatureType_1(typ_3)]);
234
+ return new FSharpType(/* Option */ 3, [signatureType_1(typ_2)]);
214
235
  case 5:
215
- return new FSharpType(/* JSApi */ 19, [new FSharpJSApi(signatureType_1(typ_4))]);
236
+ return new FSharpType(/* ResizeArray */ 14, [signatureType_1(typ_3)]);
216
237
  case 6:
217
- return new FSharpType(/* Tuple */ 12, [map(signatureType_1, types)]);
238
+ return new FSharpType(/* JSApi */ 19, [new FSharpJSApi(signatureType_1(typ_4))]);
218
239
  case 7:
219
- return new FSharpType(/* Function */ 16, [new FSharpFunctionType(map((parameter) => (new FSharpParameter(parameter.Attributes, parameter.Name, parameter.IsOptional, signatureType_1(parameter.Type), undefined)), functionType.Parameters), signatureType_1(functionType.ReturnType))]);
240
+ return new FSharpType(/* Union */ 1, [new FSharpUnion(unionInfo.Attributes, unionInfo.Name, map((_arg) => {
241
+ switch (_arg.tag) {
242
+ case 1:
243
+ return new FSharpUnionCase(/* Typed */ 1, [signatureType_1(_arg.fields[0])]);
244
+ case 2:
245
+ return new FSharpUnionCase(/* Field */ 2, [_arg.fields[0], signatureType_1(_arg.fields[1])]);
246
+ default:
247
+ return _arg;
248
+ }
249
+ }, unionInfo.Cases), unionInfo.IsOptional, unionInfo.TypeParameters, unionInfo.Constants)]);
220
250
  case 8:
251
+ return new FSharpType(/* Tuple */ 12, [map(signatureType_1, types)]);
252
+ case 9:
253
+ return new FSharpType(/* Function */ 16, [new FSharpFunctionType(map((parameter) => (new FSharpParameter(parameter.Attributes, parameter.Name, parameter.IsOptional, signatureType_1(parameter.Type), undefined)), functionType.Parameters), signatureType_1(functionType.ReturnType))]);
254
+ case 10:
221
255
  return FSharpType.Object$;
222
256
  default:
223
- return typ_5;
257
+ return typ_7;
224
258
  }
225
259
  }
226
260
 
@@ -228,38 +262,38 @@ export function signatureType(typ) {
228
262
  return signatureTypeAt(0, typ);
229
263
  }
230
264
 
231
- function canonicalTypeParameters(names, typ) {
232
- const canonical = (typ_1) => canonicalTypeParameters(names, typ_1);
265
+ function canonicalTypeParameters(erased, names, typ) {
266
+ const canonical = (typ_1) => canonicalTypeParameters(erased, names, typ_1);
233
267
  switch (typ.tag) {
234
- case 13: {
235
- const name = typ.fields[0];
236
- let matchValue;
237
- let outArg = defaultOf();
238
- matchValue = [tryGetValue(names, name, new FSharpRef(() => outArg, (v) => {
239
- outArg = v;
240
- })), outArg];
241
- if (matchValue[0]) {
242
- return new FSharpType(/* TypeParameter */ 13, [matchValue[1]]);
268
+ case 13:
269
+ if (FSharpSet__Contains(erased, typ.fields[0])) {
270
+ return FSharpType.Object$;
243
271
  }
244
272
  else {
245
- const canonicalName_1 = `T${names.size}`;
246
- names.set(name, canonicalName_1);
247
- return new FSharpType(/* TypeParameter */ 13, [canonicalName_1]);
273
+ let matchValue;
274
+ let outArg = defaultOf();
275
+ matchValue = [tryGetValue(names, typ.fields[0], new FSharpRef(() => outArg, (v) => {
276
+ outArg = v;
277
+ })), outArg];
278
+ if (matchValue[0]) {
279
+ return new FSharpType(/* TypeParameter */ 13, [matchValue[1]]);
280
+ }
281
+ else {
282
+ const canonicalName_1 = `T${names.size}`;
283
+ names.set(typ.fields[0], canonicalName_1);
284
+ return new FSharpType(/* TypeParameter */ 13, [canonicalName_1]);
285
+ }
248
286
  }
249
- }
250
- case 11: {
251
- const typeReference = typ.fields[0];
252
- return new FSharpType(/* TypeReference */ 11, [new FSharpTypeReference(typeReference.Name, typeReference.FullName, typeReference.ModulePath, map(canonical, typeReference.TypeArguments), typeReference.Type)]);
253
- }
287
+ case 11:
288
+ return new FSharpType(/* TypeReference */ 11, [new FSharpTypeReference(typ.fields[0].Name, typ.fields[0].FullName, typ.fields[0].ModulePath, map(canonical, typ.fields[0].TypeArguments), typ.fields[0].Type)]);
254
289
  case 3:
255
290
  return new FSharpType(/* Option */ 3, [canonical(typ.fields[0])]);
256
291
  case 14:
257
292
  return new FSharpType(/* ResizeArray */ 14, [canonical(typ.fields[0])]);
258
293
  case 19:
259
294
  return new FSharpType(/* JSApi */ 19, [new FSharpJSApi(canonical(typ.fields[0].fields[0]))]);
260
- case 1: {
261
- const unionInfo = typ.fields[0];
262
- return new FSharpType(/* Union */ 1, [new FSharpUnion(unionInfo.Attributes, unionInfo.Name, map((_arg) => {
295
+ case 1:
296
+ return new FSharpType(/* Union */ 1, [new FSharpUnion(typ.fields[0].Attributes, typ.fields[0].Name, map((_arg) => {
263
297
  switch (_arg.tag) {
264
298
  case 1:
265
299
  return new FSharpUnionCase(/* Typed */ 1, [canonical(_arg.fields[0])]);
@@ -268,27 +302,30 @@ function canonicalTypeParameters(names, typ) {
268
302
  default:
269
303
  return _arg;
270
304
  }
271
- }, unionInfo.Cases), unionInfo.IsOptional, unionInfo.TypeParameters, unionInfo.Constants)]);
272
- }
305
+ }, typ.fields[0].Cases), typ.fields[0].IsOptional, typ.fields[0].TypeParameters, typ.fields[0].Constants)]);
273
306
  case 12:
274
307
  return new FSharpType(/* Tuple */ 12, [map(canonical, typ.fields[0])]);
275
- case 16: {
276
- const functionType = typ.fields[0];
277
- return new FSharpType(/* Function */ 16, [new FSharpFunctionType(map((parameter) => (new FSharpParameter(parameter.Attributes, parameter.Name, parameter.IsOptional, canonical(parameter.Type), parameter.OriginalGlueMember)), functionType.Parameters), canonical(functionType.ReturnType))]);
278
- }
308
+ case 16:
309
+ return new FSharpType(/* Function */ 16, [new FSharpFunctionType(map((parameter) => (new FSharpParameter(parameter.Attributes, parameter.Name, parameter.IsOptional, canonical(parameter.Type), parameter.OriginalGlueMember)), typ.fields[0].Parameters), canonical(typ.fields[0].ReturnType))]);
279
310
  default:
280
311
  return typ;
281
312
  }
282
313
  }
283
314
 
284
- export function parametersSignature(parameters) {
315
+ export function parametersSignatureWith(erased, parameters) {
285
316
  const names = new Map([]);
286
- return map((parameter) => [canonicalTypeParameters(names, signatureType(parameter.Type)), parameter.IsOptional], parameters);
317
+ return map((parameter) => [canonicalTypeParameters(erased, names, signatureType(parameter.Type)), parameter.IsOptional], parameters);
318
+ }
319
+
320
+ export function parametersSignature(parameters) {
321
+ return parametersSignatureWith(empty({
322
+ Compare: (x, y) => (comparePrimitives(x, y) | 0),
323
+ }), parameters);
287
324
  }
288
325
 
289
- function arityOfSignature(typeParameters, signature) {
290
- const mentionsTypeParameter = (typ_mut) => {
291
- mentionsTypeParameter:
326
+ function distinguishableTypeParameters(typeParameters, parameters) {
327
+ const namesOf = (typ_mut) => {
328
+ namesOf:
292
329
  while (true) {
293
330
  const typ = typ_mut;
294
331
  let matchResult, typ_1;
@@ -333,15 +370,15 @@ function arityOfSignature(typeParameters, signature) {
333
370
  }
334
371
  switch (matchResult) {
335
372
  case 0:
336
- return true;
373
+ return singleton(typ.fields[0]);
337
374
  case 1:
338
- return exists(mentionsTypeParameter, typ.fields[0].TypeArguments);
375
+ return collect(namesOf, typ.fields[0].TypeArguments);
339
376
  case 2: {
340
377
  typ_mut = typ_1;
341
- continue mentionsTypeParameter;
378
+ continue namesOf;
342
379
  }
343
380
  case 3:
344
- return exists((_arg) => {
381
+ return collect((_arg) => {
345
382
  let matchResult_1, typ_2;
346
383
  switch (_arg.tag) {
347
384
  case 1: {
@@ -359,36 +396,63 @@ function arityOfSignature(typeParameters, signature) {
359
396
  }
360
397
  switch (matchResult_1) {
361
398
  case 0:
362
- return mentionsTypeParameter(typ_2);
399
+ return namesOf(typ_2);
363
400
  default:
364
- return false;
401
+ return empty_1();
365
402
  }
366
403
  }, typ.fields[0].Cases);
367
404
  case 4:
368
- return exists(mentionsTypeParameter, typ.fields[0]);
405
+ return collect(namesOf, typ.fields[0]);
369
406
  case 5: {
370
407
  const functionType = typ.fields[0];
371
- if (mentionsTypeParameter(functionType.ReturnType)) {
372
- return true;
373
- }
374
- else {
375
- return exists((parameter) => mentionsTypeParameter(parameter.Type), functionType.Parameters);
376
- }
408
+ return append(namesOf(functionType.ReturnType), collect((parameter) => namesOf(parameter.Type), functionType.Parameters));
377
409
  }
378
410
  default:
379
- return false;
411
+ return empty_1();
380
412
  }
381
413
  break;
382
414
  }
383
415
  };
384
- if (exists((tupledArg) => mentionsTypeParameter(tupledArg[0]), signature)) {
385
- return -1;
416
+ const mentioned = ofSeq(collect((parameter_1) => namesOf(parameter_1.Type), parameters), {
417
+ Compare: (x, y) => (comparePrimitives(x, y) | 0),
418
+ });
419
+ return length(filter((_arg_1) => {
420
+ if (_arg_1.tag === 0) {
421
+ return true;
422
+ }
423
+ else {
424
+ return !FSharpSet__Contains(mentioned, _arg_1.fields[0].Name);
425
+ }
426
+ }, typeParameters)) | 0;
427
+ }
428
+
429
+ function ownTypeParameterNames(typeParameters) {
430
+ return ofSeq(choose((_arg) => {
431
+ if (_arg.tag === 0) {
432
+ return undefined;
433
+ }
434
+ else {
435
+ return _arg.fields[0].Name;
436
+ }
437
+ }, typeParameters), {
438
+ Compare: (x, y) => (comparePrimitives(x, y) | 0),
439
+ });
440
+ }
441
+
442
+ function withoutOption(typ) {
443
+ if (typ.tag === 3) {
444
+ return typ.fields[0];
386
445
  }
387
446
  else {
388
- return length(typeParameters) | 0;
447
+ return typ;
389
448
  }
390
449
  }
391
450
 
451
+ function signatureKey(typeParameters, parameters) {
452
+ const erased = ownTypeParameterNames(typeParameters);
453
+ return [distinguishableTypeParameters(typeParameters, parameters), map((arg) => withoutOption(arg[0]), parametersSignatureWith(erased, parameters))];
454
+ }
455
+
392
456
  function withParameterlessOverloads(members) {
393
457
  const isAllOptional = (parameters) => {
394
458
  if (!isEmpty_1(parameters)) {
@@ -504,9 +568,9 @@ function withParameterlessOverloads(members) {
504
568
  }
505
569
  switch (matchResult_1) {
506
570
  case 0:
507
- return ofArray([fsharpMember_2, new FSharpMember(/* Method */ 0, [new FSharpMemberInfo(info_8.Attributes, info_8.Name, info_8.OriginalName, empty(), empty(), info_8.Type, info_8.IsOptional, info_8.IsStatic, info_8.Accessor, info_8.Accessibility, info_8.XmlDoc, info_8.Body)])]);
571
+ return ofArray([fsharpMember_2, new FSharpMember(/* Method */ 0, [new FSharpMemberInfo(info_8.Attributes, info_8.Name, info_8.OriginalName, empty_1(), empty_1(), info_8.Type, info_8.IsOptional, info_8.IsStatic, info_8.Accessor, info_8.Accessibility, info_8.XmlDoc, info_8.Body)])]);
508
572
  case 1:
509
- return ofArray([fsharpMember_2, new FSharpMember(/* StaticMember */ 2, [new FSharpStaticMemberInfo(info_9.Attributes, info_9.Name, info_9.OriginalName, empty(), empty(), info_9.Type, info_9.IsOptional, info_9.Accessor, info_9.Accessibility, info_9.XmlDoc)])]);
573
+ return ofArray([fsharpMember_2, new FSharpMember(/* StaticMember */ 2, [new FSharpStaticMemberInfo(info_9.Attributes, info_9.Name, info_9.OriginalName, empty_1(), empty_1(), info_9.Type, info_9.IsOptional, info_9.Accessor, info_9.Accessibility, info_9.XmlDoc)])]);
510
574
  default:
511
575
  return singleton(fsharpMember_2);
512
576
  }
@@ -514,8 +578,80 @@ function withParameterlessOverloads(members) {
514
578
  }
515
579
  }
516
580
 
581
+ function withoutSubsumedOverloads(members) {
582
+ const signatureOf = (fsharpMember) => {
583
+ switch (fsharpMember.tag) {
584
+ case 2: {
585
+ const info_1 = fsharpMember.fields[0];
586
+ return [[info_1.Name, false, true], info_1.TypeParameters, parametersSignature(info_1.Parameters), info_1.Type];
587
+ }
588
+ case 1:
589
+ return undefined;
590
+ default: {
591
+ const info = fsharpMember.fields[0];
592
+ return [[info.Name, true, info.IsStatic], info.TypeParameters, parametersSignature(info.Parameters), info.Type];
593
+ }
594
+ }
595
+ };
596
+ return filter((candidate) => {
597
+ const matchValue_3 = filter((other) => {
598
+ const matchValue = signatureOf(other);
599
+ const matchValue_1 = signatureOf(candidate);
600
+ let matchResult, longKey, longParameters, longType, longTypeParameters, shortKey, shortParameters, shortType, shortTypeParameters;
601
+ if (matchValue != null) {
602
+ if (matchValue_1 != null) {
603
+ matchResult = 0;
604
+ longKey = matchValue[0];
605
+ longParameters = matchValue[2];
606
+ longType = matchValue[3];
607
+ longTypeParameters = matchValue[1];
608
+ shortKey = matchValue_1[0];
609
+ shortParameters = matchValue_1[2];
610
+ shortType = matchValue_1[3];
611
+ shortTypeParameters = matchValue_1[1];
612
+ }
613
+ else {
614
+ matchResult = 1;
615
+ }
616
+ }
617
+ else {
618
+ matchResult = 1;
619
+ }
620
+ switch (matchResult) {
621
+ case 0:
622
+ if ((((equalArrays(longKey, shortKey) && equals(longTypeParameters, shortTypeParameters)) && equals(longType, shortType)) && (length(longParameters) > length(shortParameters))) && forAll2((tupledArg, tupledArg_1) => (equals(tupledArg[0], tupledArg_1[0]) && (!tupledArg_1[1] ? true : tupledArg[1])), take(length(shortParameters), longParameters), shortParameters)) {
623
+ return forAll((tuple) => tuple[1], skip(length(shortParameters), longParameters));
624
+ }
625
+ else {
626
+ return false;
627
+ }
628
+ default:
629
+ return false;
630
+ }
631
+ }, members);
632
+ let matchResult_1;
633
+ if (!isEmpty_1(matchValue_3)) {
634
+ if (isEmpty_1(tail(matchValue_3))) {
635
+ matchResult_1 = 0;
636
+ }
637
+ else {
638
+ matchResult_1 = 1;
639
+ }
640
+ }
641
+ else {
642
+ matchResult_1 = 1;
643
+ }
644
+ switch (matchResult_1) {
645
+ case 0:
646
+ return false;
647
+ default:
648
+ return true;
649
+ }
650
+ }, members);
651
+ }
652
+
517
653
  export function distinctBySignature(members) {
518
- const members_1 = withParameterlessOverloads(members);
654
+ const members_2 = withParameterlessOverloads(withoutSubsumedOverloads(members));
519
655
  const methodNames = ofSeq(choose((_arg) => {
520
656
  if (_arg.tag === 0) {
521
657
  return _arg.fields[0].Name;
@@ -523,7 +659,7 @@ export function distinctBySignature(members) {
523
659
  else {
524
660
  return undefined;
525
661
  }
526
- }, members_1), {
662
+ }, members_2), {
527
663
  Compare: (x, y) => (comparePrimitives(x, y) | 0),
528
664
  });
529
665
  return map((tupledArg) => maxBy((fsharpMember) => {
@@ -555,17 +691,17 @@ export function distinctBySignature(members) {
555
691
  switch (_arg_2.tag) {
556
692
  case 1: {
557
693
  const info_3 = _arg_2.fields[0];
558
- return new FSharpChoice$3(/* Choice2Of3 */ 1, [[info_3.Name, map((tuple_1) => tuple_1[0], parametersSignature(info_3.Parameters))]]);
694
+ return new FSharpChoice$3(/* Choice2Of3 */ 1, [[info_3.Name, map((tuple) => tuple[0], parametersSignature(info_3.Parameters))]]);
559
695
  }
560
696
  case 2: {
561
697
  const info_4 = _arg_2.fields[0];
562
- const signature_1 = map((tuple_2) => tuple_2[0], parametersSignature(info_4.Parameters));
563
- return new FSharpChoice$3(/* Choice3Of3 */ 2, [[info_4.Name, arityOfSignature(info_4.TypeParameters, parametersSignature(info_4.Parameters)), signature_1]]);
698
+ const patternInput_1 = signatureKey(info_4.TypeParameters, info_4.Parameters);
699
+ return new FSharpChoice$3(/* Choice3Of3 */ 2, [[info_4.Name, patternInput_1[0], patternInput_1[1]]]);
564
700
  }
565
701
  default: {
566
702
  const info_2 = _arg_2.fields[0];
567
- const signature = map((tuple) => tuple[0], parametersSignature(info_2.Parameters));
568
- return new FSharpChoice$3(/* Choice1Of3 */ 0, [[info_2.Name, arityOfSignature(info_2.TypeParameters, parametersSignature(info_2.Parameters)), signature]]);
703
+ const patternInput = signatureKey(info_2.TypeParameters, info_2.Parameters);
704
+ return new FSharpChoice$3(/* Choice1Of3 */ 0, [[info_2.Name, patternInput[0], patternInput[1]]]);
569
705
  }
570
706
  }
571
707
  }, filter((_arg_1) => {
@@ -575,7 +711,7 @@ export function distinctBySignature(members) {
575
711
  else {
576
712
  return true;
577
713
  }
578
- }, members_1), {
714
+ }, members_2), {
579
715
  Equals: equals,
580
716
  GetHashCode: (x_1) => (safeHash(x_1) | 0),
581
717
  }));
@@ -732,7 +868,7 @@ function distinctMembers(types) {
732
868
  export function apply(types) {
733
869
  aliasTargets.clear();
734
870
  genericAliasTargets.clear();
735
- collectAliases(empty(), types);
871
+ collectAliases(empty_1(), types);
736
872
  return distinctMembers(dropEmptyModules(mergeModules(mergeTypes(types))));
737
873
  }
738
874
 
@@ -3,6 +3,8 @@ import { toString, Record } from "../fable_modules/fable-library-js.5.17.2/Types
3
3
  import { GlueModuleDeclaration, GlueType, GlueFileModule, GlueType_$reflection } from "./GlueAST.js";
4
4
  import { tuple_type, option_type, bool_type, record_type, string_type, list_type } from "../fable_modules/fable-library-js.5.17.2/Reflection.js";
5
5
  import { FSharpType_$reflection } from "./FsharpAST.js";
6
+ import { Bootstrap_reachableFiles, Bootstrap_createProgramFromFiles, Resolve_listInstalledPackages, Resolve_findPackageDir, Resolve_describePackage, Resolve_resolveInput, Npm_installPackage, createInMemoryHost as createInMemoryHost_1 } from "./Hosting.js";
7
+ import { toNullable } from "../fable_modules/fable-library-js.5.17.2/Option.js";
6
8
  import { FSharpSet__get_IsEmpty, FSharpSet__Contains, filter, map as map_2, ofSeq } from "../fable_modules/fable-library-js.5.17.2/Set.js";
7
9
  import { stringHash, Exception, defaultOf, equals, comparePrimitives } from "../fable_modules/fable-library-js.5.17.2/Util.js";
8
10
  import { replace, concat, split, substring, join } from "../fable_modules/fable-library-js.5.17.2/String.js";
@@ -10,9 +12,7 @@ import { map } from "../fable_modules/fable-library-js.5.17.2/Array.js";
10
12
  import { normalizePath } from "./Utils/String.js";
11
13
  import { append as append_1, contains, sortBy, tryFind, filter as filter_1, exists, cons, collect, toArray, singleton, isEmpty, choose, empty, ofArray, map as map_1 } from "../fable_modules/fable-library-js.5.17.2/List.js";
12
14
  import { PackageContext__TryFindPackage_Z721C83C5, PackageContext, ExternalPackage, PackageInfo } from "./Reader/Types.js";
13
- import { findPackageDir, resolveInput, listInstalledPackages, describePackage } from "../../src/Glutinum.Converter/js/resolve.js";
14
15
  import { List_distinct } from "../fable_modules/fable-library-js.5.17.2/Seq2.js";
15
- import { reachableFiles, createProgramFromFiles } from "../../src/Glutinum.Converter/js/bootstrap.js";
16
16
  import { singleton as singleton_1, collect as collect_1, empty as empty_1, append, delay, toList } from "../fable_modules/fable-library-js.5.17.2/Seq.js";
17
17
  import { readPackages } from "./Read.js";
18
18
  import { applyWith } from "./Transform.js";
@@ -33,6 +33,42 @@ export function GenerationResult_$reflection() {
33
33
  return record_type("Glutinum.Converter.Packages.GenerationResult", [], GenerationResult, () => [["GlueAST", list_type(GlueType_$reflection())], ["FSharpAST", list_type(FSharpType_$reflection())], ["FSharpCode", string_type], ["Warnings", list_type(string_type)], ["Errors", list_type(string_type)]]);
34
34
  }
35
35
 
36
+ export function createInMemoryHost(cwd) {
37
+ return createInMemoryHost_1(cwd);
38
+ }
39
+
40
+ /**
41
+ * Download the declaration files of a package, and of the packages it depends on,
42
+ * from jsDelivr into <c>/node_modules</c> of the file system.
43
+ */
44
+ export function installPackage(fileSystem, spec, options) {
45
+ return Npm_installPackage(fileSystem, spec, options);
46
+ }
47
+
48
+ function resolveInput(host, input) {
49
+ return Resolve_resolveInput(host, input);
50
+ }
51
+
52
+ function describePackage(host, packageDir) {
53
+ return toNullable(Resolve_describePackage(host, packageDir));
54
+ }
55
+
56
+ function findPackageDir(host, file) {
57
+ return toNullable(Resolve_findPackageDir(host, file));
58
+ }
59
+
60
+ function listInstalledPackages(host) {
61
+ return Resolve_listInstalledPackages(host);
62
+ }
63
+
64
+ function createProgramFromFiles(host, entryFiles, options) {
65
+ return Bootstrap_createProgramFromFiles(host, entryFiles, options.withoutDomLib, options.noLib);
66
+ }
67
+
68
+ function reachableFiles(host, program, entryFiles, excludedRuntimeNames) {
69
+ return Bootstrap_reachableFiles(host, program, entryFiles, excludedRuntimeNames);
70
+ }
71
+
36
72
  const domLibReplacements = ofSeq(["@types/web", "@typescript/lib-dom"], {
37
73
  Compare: (x, y) => (comparePrimitives(x, y) | 0),
38
74
  });
@@ -42,7 +78,7 @@ function moduleNameForPackage(runtimeName) {
42
78
  }
43
79
 
44
80
  function toPackageInfo(description) {
45
- return new PackageInfo(moduleNameForPackage(description.runtimeName), description.runtimeName, normalizePath(description.dir) + "/", normalizePath(description.typesRoot) + "/", normalizePath(description.entryFile), map_1((entry) => [normalizePath(entry.file), entry.subpath], ofArray(description.subpathEntries)));
81
+ return new PackageInfo(moduleNameForPackage(description.runtimeName), description.runtimeName, description.hasRuntime, normalizePath(description.dir) + "/", normalizePath(description.typesRoot) + "/", normalizePath(description.entryFile), map_1((entry) => [normalizePath(entry.file), entry.subpath], ofArray(description.subpathEntries)));
46
82
  }
47
83
 
48
84
  function isTypeScriptLibFile(fileName) {
@@ -94,7 +130,7 @@ function declarationName(glueType_mut) {
94
130
  return glueType.fields[0].Name;
95
131
  case 6:
96
132
  return glueType.fields[0].Name;
97
- case 24: {
133
+ case 25: {
98
134
  glueType_mut = glueType.fields[0];
99
135
  continue declarationName;
100
136
  }
@@ -113,7 +149,7 @@ function isValue(glueType_mut) {
113
149
  case 2:
114
150
  case 6:
115
151
  return true;
116
- case 24: {
152
+ case 25: {
117
153
  glueType_mut = glueType.fields[0];
118
154
  continue isValue;
119
155
  }
@@ -130,13 +166,13 @@ function keepIncluded(included, types) {
130
166
  });
131
167
  return choose((glueType) => {
132
168
  switch (glueType.tag) {
133
- case 30: {
169
+ case 31: {
134
170
  const matchValue = keepIncluded(included, glueType.fields[0].Types);
135
171
  if (isEmpty(matchValue)) {
136
172
  return undefined;
137
173
  }
138
174
  else {
139
- return new GlueType(/* FileModule */ 30, [new GlueFileModule(glueType.fields[0].Name, glueType.fields[0].ImportSpecifier, glueType.fields[0].IsGlobal, matchValue)]);
175
+ return new GlueType(/* FileModule */ 31, [new GlueFileModule(glueType.fields[0].Name, glueType.fields[0].ImportSpecifier, glueType.fields[0].IsGlobal, glueType.fields[0].HasRuntime, matchValue)]);
140
176
  }
141
177
  }
142
178
  case 11:
@@ -286,7 +322,7 @@ export function generateWith(options, host, inputs) {
286
322
  return package$_2;
287
323
  }
288
324
  else {
289
- return new PackageInfo(moduleName_3, package$_2.RuntimeName, package$_2.Dir, package$_2.TypesRoot, package$_2.EntryFile, package$_2.SubpathEntries);
325
+ return new PackageInfo(moduleName_3, package$_2.RuntimeName, package$_2.HasRuntime, package$_2.Dir, package$_2.TypesRoot, package$_2.EntryFile, package$_2.SubpathEntries);
290
326
  }
291
327
  }, map_1(toPackageInfo, targets));
292
328
  const included = ofSeq(options.Include, {