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

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,5 +1,5 @@
1
1
 
2
- import { typeLiteralId, readTypeArguments, entityNameText, getFullNameOrEmpty, defaultTypeArguments, identifierText, isTupleType, resolveAlias, symbolAtLocation, withInProgress, $007CHasSymbolFlags$007C_$007C, typeNodeBuilderFlags, Type_NumberLiteral_$007CInt$007CFloat$007COther$007C, Type_StringLiteral_$007CString$007COther$007C, $007CHasTypeFlags$007C_$007C } from "./Utils.js";
2
+ import { isFromEsLib, typeLiteralId, readTypeArguments, entityNameText, getFullNameOrEmpty, defaultTypeArguments, identifierText, isTupleType, resolveAlias, symbolAtLocation, withInProgress, $007CHasSymbolFlags$007C_$007C, typeNodeBuilderFlags, Type_NumberLiteral_$007CInt$007CFloat$007COther$007C, Type_StringLiteral_$007CString$007COther$007C, $007CHasTypeFlags$007C_$007C } from "./Utils.js";
3
3
  import { Report_readerError_Z19516DCE } from "./Report.js";
4
4
  import { item as item_4, contains, filter as filter_1, append, collect, map, ofArray, isEmpty, choose, singleton, empty } from "../../fable_modules/fable-library-js.5.21.0/List.js";
5
5
  import { GlueReadonly, GlueRecord, GlueUtilityType, GlueInterface, GlueSubstitution_substituteMember, GlueSubstitution_mentionedTypeParameters, GlueTypeLiteral, GluePrimitive, GlueTypeUnion, GlueType, GlueLiteral } from "../GlueAST.js";
@@ -767,23 +767,53 @@ export function readPick(reader, typeReferenceNode) {
767
767
  }
768
768
 
769
769
  export function readReadonly(reader, typeReferenceNode) {
770
+ let typeArguments;
770
771
  const typ = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"]().getTypeFromTypeNode(typeReferenceNode);
771
- const matchValue = typ.flags;
772
- let matchResult;
773
- if ($007CHasTypeFlags$007C_$007C(1048576, matchValue) != null) {
774
- matchResult = 0;
775
- }
776
- else if ($007CHasTypeFlags$007C_$007C(268435456, matchValue) != null) {
777
- matchResult = 0;
772
+ let isLibraryType;
773
+ const matchValue = typeReferenceNode.typeArguments;
774
+ let matchResult, typeArguments_1;
775
+ if (matchValue != null) {
776
+ if ((typeArguments = matchValue, ~~typeArguments.length === 1)) {
777
+ matchResult = 0;
778
+ typeArguments_1 = matchValue;
779
+ }
780
+ else {
781
+ matchResult = 1;
782
+ }
778
783
  }
779
784
  else {
780
785
  matchResult = 1;
781
786
  }
782
787
  switch (matchResult) {
788
+ case 0: {
789
+ const argument = typeArguments_1[0];
790
+ isLibraryType = ((argument.kind === 184) && isFromEsLib(symbolAtLocation(reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"](), argument.typeName)));
791
+ break;
792
+ }
793
+ default:
794
+ isLibraryType = false;
795
+ }
796
+ const matchValue_1 = typ.flags;
797
+ let matchResult_1;
798
+ if (isLibraryType) {
799
+ matchResult_1 = 0;
800
+ }
801
+ else if ($007CHasTypeFlags$007C_$007C(1048576, matchValue_1) != null) {
802
+ matchResult_1 = 1;
803
+ }
804
+ else if ($007CHasTypeFlags$007C_$007C(268435456, matchValue_1) != null) {
805
+ matchResult_1 = 1;
806
+ }
807
+ else {
808
+ matchResult_1 = 2;
809
+ }
810
+ switch (matchResult_1) {
783
811
  case 0:
812
+ return reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNode24A678AD"](value_6(typeReferenceNode.typeArguments)[0]);
813
+ case 1:
784
814
  return new GlueType(/* UtilityType */ 27, [new GlueUtilityType(/* Readonly */ 6, [new GlueReadonly(/* Members */ 0, [readMembers(reader, typeReferenceNode, typ)])])]);
785
815
  default:
786
- if ($007CHasTypeFlags$007C_$007C(134217728, matchValue) != null) {
816
+ if ($007CHasTypeFlags$007C_$007C(134217728, matchValue_1) != null) {
787
817
  const unionType = typ;
788
818
  try {
789
819
  return new GlueType(/* UtilityType */ 27, [new GlueUtilityType(/* Readonly */ 6, [new GlueReadonly(/* Union */ 1, [toList(choose_1((innerType) => {
@@ -796,8 +826,8 @@ export function readReadonly(reader, typeReferenceNode) {
796
826
  }
797
827
  }, unionType.types))])])]);
798
828
  }
799
- catch (matchValue_1) {
800
- const item = Report_readerError_Z19516DCE("Readonly", "Unable to read the members of the union type", typeReferenceNode, "/_//src/Glutinum.Converter/Reader/UtilityType.fs", 703);
829
+ catch (matchValue_2) {
830
+ const item = Report_readerError_Z19516DCE("Readonly", "Unable to read the members of the union type", typeReferenceNode, "/_//src/Glutinum.Converter/Reader/UtilityType.fs", 715);
801
831
  const objectArg = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_Warnings"]();
802
832
  void (objectArg.push(item));
803
833
  return new GlueType(/* Primitive */ 3, [GluePrimitive.Any]);
@@ -1,7 +1,7 @@
1
1
 
2
2
  import { ofList as ofList_1, empty as empty_1, FSharpSet__Add, FSharpSet__Contains, ofSeq } from "../../fable_modules/fable-library-js.5.21.0/Set.js";
3
3
  import { equals, comparePrimitives } from "../../fable_modules/fable-library-js.5.21.0/Util.js";
4
- import { exists, take, forAll2, length, forAll, indexed as indexed_1, fold, head, tail, isEmpty, map, singleton, filter, empty, choose, append, collect, tryPick } from "../../fable_modules/fable-library-js.5.21.0/List.js";
4
+ import { exists, take, forAll2, length, forAll, indexed as indexed_1, fold, head, tail, map, singleton, filter, empty, choose, append, collect, tryPick, isEmpty } from "../../fable_modules/fable-library-js.5.21.0/List.js";
5
5
  import { defaultArg } from "../../fable_modules/fable-library-js.5.21.0/Option.js";
6
6
  import { Record } from "../../fable_modules/fable-library-js.5.21.0/Types.js";
7
7
  import { GlueSubstitution_substitute, GlueSubstitution_substituteMember, GlueSubstitution_ofTypeArguments, GlueSubstitution_substituteParameter, GluePrimitive, GlueTypeReference, GlueTypeUnion, GlueType, GlueFunctionType, GlueParameter, GlueType_$reflection, GlueMember_$reflection, GlueTypeParameter_$reflection } from "../GlueAST.js";
@@ -37,8 +37,9 @@ export function isInheritableType(typ) {
37
37
  */
38
38
  export function isSelfHeritage(fullName, heritageClause) {
39
39
  if (heritageClause.tag === 13) {
40
- if (fullName !== "") {
41
- return heritageClause.fields[0].FullName === fullName;
40
+ const typeReference = heritageClause.fields[0];
41
+ if ((fullName !== "") && (typeReference.FullName === fullName)) {
42
+ return isEmpty(typeReference.ModulePath);
42
43
  }
43
44
  else {
44
45
  return false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@glutinum/cli",
3
- "version": "1.0.0-beta.13",
3
+ "version": "1.0.0-beta.14",
4
4
  "description": "TypeScript definition to F# bindings converter",
5
5
  "type": "module",
6
6
  "main": "index.js",