@glutinum/cli 1.0.0-beta.13 → 1.0.0-beta.15

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 (34) hide show
  1. package/dist/Glutinum.Converter/GlueAST.js +19 -14
  2. package/dist/Glutinum.Converter/Merge.js +480 -205
  3. package/dist/Glutinum.Converter/Packages.js +2 -2
  4. package/dist/Glutinum.Converter/Printer.js +26 -21
  5. package/dist/Glutinum.Converter/Read.js +377 -169
  6. package/dist/Glutinum.Converter/Reader/ClassDeclaration.js +25 -8
  7. package/dist/Glutinum.Converter/Reader/ConditionalTypeNode.js +2 -2
  8. package/dist/Glutinum.Converter/Reader/Declaration.js +15 -15
  9. package/dist/Glutinum.Converter/Reader/Deferred.js +114 -43
  10. package/dist/Glutinum.Converter/Reader/ExportAssignment.js +98 -44
  11. package/dist/Glutinum.Converter/Reader/ExportDeclaration.js +2 -2
  12. package/dist/Glutinum.Converter/Reader/IndexedAccessType.js +61 -46
  13. package/dist/Glutinum.Converter/Reader/InterfaceDeclaration.js +4 -4
  14. package/dist/Glutinum.Converter/Reader/IntersectionTypeNode.js +38 -25
  15. package/dist/Glutinum.Converter/Reader/MappedTypeNode.js +6 -5
  16. package/dist/Glutinum.Converter/Reader/Node.js +1 -1
  17. package/dist/Glutinum.Converter/Reader/TypeNode.js +244 -29
  18. package/dist/Glutinum.Converter/Reader/TypeOperatorNode.js +1 -1
  19. package/dist/Glutinum.Converter/Reader/TypeQueryNode.js +143 -35
  20. package/dist/Glutinum.Converter/Reader/UtilityType.js +153 -40
  21. package/dist/Glutinum.Converter/Reader/Utils.js +186 -17
  22. package/dist/Glutinum.Converter/Reader/VariableStatement.js +46 -16
  23. package/dist/Glutinum.Converter/Transform.js +1062 -629
  24. package/dist/Glutinum.Converter/Transformer/CallableProperties.js +2 -2
  25. package/dist/Glutinum.Converter/Transformer/Conditionals.js +17 -16
  26. package/dist/Glutinum.Converter/Transformer/Context.js +12 -4
  27. package/dist/Glutinum.Converter/Transformer/Exports.js +242 -66
  28. package/dist/Glutinum.Converter/Transformer/Heritage.js +278 -19
  29. package/dist/Glutinum.Converter/Transformer/KeyOfMaps.js +4 -4
  30. package/dist/Glutinum.Converter/Transformer/ParamObjectCandidate.js +105 -19
  31. package/dist/Glutinum.Converter/Transformer/TypeParameters.js +2 -2
  32. package/dist/Glutinum.Converter/Transformer/Utils.js +3 -3
  33. package/dist/Glutinum.Converter/Utils/Naming.js +10 -3
  34. package/package.json +1 -1
@@ -412,13 +412,13 @@ function keepIncluded(included, types) {
412
412
  });
413
413
  return choose((glueType) => {
414
414
  switch (glueType.tag) {
415
- case 31: {
415
+ case 32: {
416
416
  const matchValue = keepIncluded(included, glueType.fields[0].Types);
417
417
  if (isEmpty(matchValue)) {
418
418
  return undefined;
419
419
  }
420
420
  else {
421
- return new GlueType(/* FileModule */ 31, [new GlueFileModule(glueType.fields[0].Name, glueType.fields[0].ImportSpecifier, glueType.fields[0].SymbolSpecifiers, glueType.fields[0].IsGlobal, glueType.fields[0].HasRuntime, matchValue)]);
421
+ return new GlueType(/* FileModule */ 32, [new GlueFileModule(glueType.fields[0].Name, glueType.fields[0].ImportSpecifier, glueType.fields[0].SymbolSpecifiers, glueType.fields[0].IsGlobal, glueType.fields[0].HasRuntime, matchValue)]);
422
422
  }
423
423
  }
424
424
  case 11:
@@ -585,12 +585,16 @@ function printInterfaceMethod(printer, methodInfo) {
585
585
  Printer__get_NewLine(printer);
586
586
  }
587
587
 
588
+ function emitString(macro) {
589
+ return ("\"" + replace(replace(replace(macro, "\\", "\\\\"), "\"", "\\\""), "\n", "\\n")) + "\"";
590
+ }
591
+
588
592
  function printInterfaceProperty(printer, interfaceInfo, propertyInfo) {
589
593
  printXmlDoc(printer, propertyInfo.XmlDoc);
590
594
  printAttributes(printer, propertyInfo.Attributes);
591
595
  if (propertyInfo.IsStatic) {
592
596
  if (propertyInfo.Body.tag === 1) {
593
- Printer__Write_Z721C83C5(printer, concat("[<Emit(\"\"\"", ((((((("import { " + interfaceInfo.OriginalName) + " } from \"") + Printer__get_ImportSpecifier(printer)) + "\";\n") + interfaceInfo.OriginalName) + ".") + propertyInfo.OriginalName) + "{{=$0}}", "\"\"\")>]"));
597
+ Printer__Write_Z721C83C5(printer, concat("[<Emit(", emitString(((((((("import { " + interfaceInfo.OriginalName) + " } from \"") + Printer__get_ImportSpecifier(printer)) + "\";\n") + interfaceInfo.OriginalName) + ".") + propertyInfo.OriginalName) + "{{=$0}}"), ")>]"));
594
598
  Printer__get_NewLine(printer);
595
599
  }
596
600
  Printer__Write_Z721C83C5(printer, "static member inline ");
@@ -680,8 +684,8 @@ function printInterfaceStaticMember(printer, interfaceInfo, staticMemberInfo) {
680
684
  printXmlDoc(printer, staticMemberInfo.XmlDoc);
681
685
  printCompactAttributesAndNewLine(printer, staticMemberInfo.Attributes);
682
686
  const macroArguments = join(", ", mapIndexed((index, _arg) => (`$${index}`), staticMemberInfo.Parameters));
683
- Printer__Write_Z721C83C5(printer, `[<Emit("""import { ${interfaceInfo.OriginalName} } from "${Printer__get_ImportSpecifier(printer)}";
684
- ${interfaceInfo.OriginalName}.${staticMemberInfo.OriginalName}(${macroArguments})""")>]`);
687
+ Printer__Write_Z721C83C5(printer, concat("[<Emit(", emitString(`import { ${interfaceInfo.OriginalName} } from "${Printer__get_ImportSpecifier(printer)}";
688
+ ${interfaceInfo.OriginalName}.${staticMemberInfo.OriginalName}(${macroArguments})`), ")>]"));
685
689
  Printer__get_NewLine(printer);
686
690
  Printer__Write_Z721C83C5(printer, concat("static member inline ", staticMemberInfo.Name, " "));
687
691
  printTypeParametersDeclaration(printer, staticMemberInfo.TypeParameters);
@@ -967,7 +971,7 @@ function printUnion(printer, unionInfo) {
967
971
  Printer__Write_Z721C83C5(printer, `static member inline ${constant.Name}: ${unionInfo.Name} = ${unionInfo.Name}.${constant.Case} ${constant.Value}`);
968
972
  Printer__get_NewLine(printer);
969
973
  }, unionInfo.Constants);
970
- if (exists((_arg) => {
974
+ const isErased = exists((_arg) => {
971
975
  switch (_arg.tag) {
972
976
  case 6:
973
977
  case 7:
@@ -975,24 +979,25 @@ function printUnion(printer, unionInfo) {
975
979
  default:
976
980
  return false;
977
981
  }
978
- }, unionInfo.Attributes)) {
979
- const returnType = printTypeNameWithTypeParameters(unionInfo.Name, unionInfo.TypeParameters);
980
- iterate((caseType) => {
981
- const enumerator = getEnumerator(["op_Implicit", "op_ErasedCast"]);
982
- try {
983
- while (enumerator["System.Collections.IEnumerator.MoveNext"]()) {
984
- const name_2 = enumerator["System.Collections.Generic.IEnumerator`1.get_Current"]();
985
- Printer__get_NewLine(printer);
986
- Printer__Write_Z721C83C5(printer, "[<Emit(\"$0\")>]");
987
- Printer__get_NewLine(printer);
988
- Printer__Write_Z721C83C5(printer, `static member ${name_2}(value: ${caseType}) : ${returnType} = nativeOnly`);
989
- Printer__get_NewLine(printer);
990
- }
991
- }
992
- finally {
993
- disposeSafe(enumerator);
982
+ }, unionInfo.Attributes);
983
+ const returnType = printTypeNameWithTypeParameters(unionInfo.Name, unionInfo.TypeParameters);
984
+ iterate((caseType) => {
985
+ const enumerator = getEnumerator(["op_Implicit", "op_ErasedCast"]);
986
+ try {
987
+ while (enumerator["System.Collections.IEnumerator.MoveNext"]()) {
988
+ const name_2 = enumerator["System.Collections.Generic.IEnumerator`1.get_Current"]();
989
+ Printer__get_NewLine(printer);
990
+ Printer__Write_Z721C83C5(printer, "[<Emit(\"$0\")>]");
991
+ Printer__get_NewLine(printer);
992
+ Printer__Write_Z721C83C5(printer, `static member ${name_2}(value: ${caseType}) : ${returnType} = nativeOnly`);
993
+ Printer__get_NewLine(printer);
994
994
  }
995
- }, map(printType, unionInfo.Conversions));
995
+ }
996
+ finally {
997
+ disposeSafe(enumerator);
998
+ }
999
+ }, map(printType, unionInfo.Conversions));
1000
+ if (isErased) {
996
1001
  iterate((_arg_1) => {
997
1002
  if (_arg_1.tag === 2) {
998
1003
  const caseName = _arg_1.fields[0];