@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
@@ -1,17 +1,17 @@
1
1
 
2
2
  import { defaultOf, equals } from "../../fable_modules/fable-library-js.5.21.0/Util.js";
3
- import { PackageContext__DefaultExportName_Z721C83C5, PackageContext__TryFindPackage_Z721C83C5 } from "./Types.js";
3
+ import { PackageContext__IsExternal_Z721C83C5, PackageContext__DefaultExportName_Z721C83C5, PackageContext__TryFindPackage_Z721C83C5 } from "./Types.js";
4
4
  import { normalizePath } from "../Utils/String.js";
5
- import { forAll } from "../../fable_modules/fable-library-js.5.21.0/Seq.js";
5
+ import { tryFind, forAll } from "../../fable_modules/fable-library-js.5.21.0/Seq.js";
6
6
  import { isLetterOrDigit } from "../../fable_modules/fable-library-js.5.21.0/Char.js";
7
7
  import { Operators_IsNull } from "../../fable_modules/fable-library-js.5.21.0/FSharp.Core.js";
8
- import { primitiveOfFlags, $007CHasTypeFlags$007C_$007C, $007CHasSymbolFlags$007C_$007C } from "./Utils.js";
8
+ import { primitiveOfFlags, $007CHasTypeFlags$007C_$007C, modulePathForDeclaration, resolveAlias, $007CHasSymbolFlags$007C_$007C } from "./Utils.js";
9
9
  import { value as value_2, some, defaultArg } from "../../fable_modules/fable-library-js.5.21.0/Option.js";
10
- import { GlueVariable, GlueFunctionDeclaration, GluePrimitive, GlueType } from "../GlueAST.js";
10
+ import { GlueVariable, GlueFunctionDeclaration, GluePrimitive, GlueType, GlueReExport } from "../GlueAST.js";
11
11
  import { item } from "../../fable_modules/fable-library-js.5.21.0/Array.js";
12
12
 
13
13
  export function readExportAssignment(reader, exportNode) {
14
- let declaration, package$, name_1, declares, exports, option_5, moduleSymbol, declaration_1, declarations;
14
+ let declaration, package$, name_1, declares, exports, option_5, moduleSymbol, symbol_2, matchValue_2, declaration_2, declarationFile, declaration_3, declaration_4, declarations;
15
15
  const symbolOpt = exportNode.symbol;
16
16
  let targetDeclarationKind;
17
17
  if (exportNode.expression.kind === 80) {
@@ -70,31 +70,76 @@ export function readExportAssignment(reader, exportNode) {
70
70
  let publishedName;
71
71
  const option_16 = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_PackageContext"]();
72
72
  publishedName = ((option_16 != null) ? PackageContext__DefaultExportName_Z721C83C5(option_16, sourceFile.fileName) : undefined);
73
- const isExportEqualsOfVariable = equals(exportEqualsDeclarationKind, 261);
73
+ const isExportEqualsOfNamespace = equals(exportEqualsDeclarationKind, 268) && (exportNode.parent.kind === 269);
74
+ const isExportEqualsOfVariable = equals(exportEqualsDeclarationKind, 261) ? true : isExportEqualsOfNamespace;
74
75
  const isExportEqualsOfDeclaration = equals(exportEqualsDeclarationKind, 263) ? true : equals(exportEqualsDeclarationKind, 264);
76
+ let importedClass;
77
+ const matchValue_1 = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_PackageContext"]();
78
+ let matchResult, packageContext_3;
79
+ if (matchValue_1 != null) {
80
+ if (!equals(exportNode.isExportEquals, true) && (exportNode.expression.kind === 80)) {
81
+ matchResult = 0;
82
+ packageContext_3 = matchValue_1;
83
+ }
84
+ else {
85
+ matchResult = 1;
86
+ }
87
+ }
88
+ else {
89
+ matchResult = 1;
90
+ }
91
+ switch (matchResult) {
92
+ case 0: {
93
+ let option_28;
94
+ let option_26;
95
+ let option_24;
96
+ let option_22;
97
+ let option_19;
98
+ const option_18 = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"]().getSymbolAtLocation(exportNode.expression);
99
+ option_19 = ((option_18 != null) ? (((symbol_2 = option_18, (matchValue_2 = symbol_2.flags, $007CHasSymbolFlags$007C_$007C(2097152, matchValue_2) != null))) ? option_18 : undefined) : undefined);
100
+ let binder_6;
101
+ const checker = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"]();
102
+ binder_6 = ((symbol_3) => resolveAlias(checker, symbol_3));
103
+ const option_20 = option_19;
104
+ option_22 = ((option_20 != null) ? binder_6(option_20) : undefined);
105
+ if (option_22 != null) {
106
+ const symbol_4 = option_22;
107
+ option_24 = symbol_4.declarations;
108
+ }
109
+ else {
110
+ option_24 = undefined;
111
+ }
112
+ option_26 = ((option_24 != null) ? tryFind((declaration_1) => (declaration_1.kind === 264), option_24) : undefined);
113
+ option_28 = ((option_26 != null) ? (((declaration_2 = option_26, (declarationFile = normalizePath(declaration_2.getSourceFile().fileName), (declarationFile !== normalizePath(sourceFile.fileName)) && !PackageContext__IsExternal_Z721C83C5(packageContext_3, declarationFile)))) ? option_26 : undefined) : undefined);
114
+ importedClass = ((option_28 != null) ? ((declaration_3 = option_28, new GlueReExport(exportNode.expression.getText(), reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadNode6C0FD055"](declaration_3), modulePathForDeclaration(packageContext_3, declaration_3)))) : undefined);
115
+ break;
116
+ }
117
+ default:
118
+ importedClass = undefined;
119
+ }
75
120
  if (symbolOpt == null) {
76
121
  return GlueType.Discard;
77
122
  }
78
- else {
79
- const symbol_2 = symbolOpt;
80
- if (((symbol_2.name === "default") ? true : isExportEqualsOfVariable) ? true : isExportEqualsOfDeclaration) {
123
+ else if (importedClass == null) {
124
+ const symbol_5 = symbolOpt;
125
+ if (((symbol_5.name === "default") ? true : isExportEqualsOfVariable) ? true : isExportEqualsOfDeclaration) {
81
126
  if (exportNode.expression.kind === 80) {
82
127
  const identiferNode = exportNode.expression;
83
128
  let declaredTypeNode;
84
- let option_22;
85
- let option_20;
86
- const option_18 = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"]().getSymbolAtLocation(exportNode.expression);
87
- if (option_18 != null) {
88
- const _arg_1 = option_18;
89
- option_20 = _arg_1.valueDeclaration;
129
+ let option_34;
130
+ let option_32;
131
+ const option_30 = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"]().getSymbolAtLocation(exportNode.expression);
132
+ if (option_30 != null) {
133
+ const _arg_1 = option_30;
134
+ option_32 = _arg_1.valueDeclaration;
90
135
  }
91
136
  else {
92
- option_20 = undefined;
137
+ option_32 = undefined;
93
138
  }
94
- option_22 = ((option_20 != null) ? (((declaration_1 = option_20, declaration_1.kind === 261)) ? option_20 : undefined) : undefined);
95
- if (option_22 != null) {
96
- const declaration_2 = option_22;
97
- declaredTypeNode = declaration_2.type;
139
+ option_34 = ((option_32 != null) ? (((declaration_4 = option_32, declaration_4.kind === 261)) ? option_32 : undefined) : undefined);
140
+ if (option_34 != null) {
141
+ const declaration_5 = option_34;
142
+ declaredTypeNode = declaration_5.type;
98
143
  }
99
144
  else {
100
145
  declaredTypeNode = undefined;
@@ -102,34 +147,39 @@ export function readExportAssignment(reader, exportNode) {
102
147
  let typ;
103
148
  const tsTyp = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"]().getTypeAtLocation(exportNode.expression);
104
149
  if (declaredTypeNode == null) {
105
- const matchValue_2 = tsTyp.flags;
106
- if ($007CHasTypeFlags$007C_$007C(1048576, matchValue_2) != null) {
107
- const matchValue_3 = tsTyp.symbol.declarations;
108
- let matchResult, declarations_1;
109
- if (matchValue_3 != null) {
110
- if ((declarations = matchValue_3, declarations.length === 1)) {
111
- matchResult = 0;
112
- declarations_1 = matchValue_3;
150
+ if (isExportEqualsOfNamespace) {
151
+ typ = (new GlueType(/* Primitive */ 3, [GluePrimitive.Any]));
152
+ }
153
+ else {
154
+ const matchValue_5 = tsTyp.flags;
155
+ if ($007CHasTypeFlags$007C_$007C(1048576, matchValue_5) != null) {
156
+ const matchValue_6 = tsTyp.symbol.declarations;
157
+ let matchResult_1, declarations_1;
158
+ if (matchValue_6 != null) {
159
+ if ((declarations = matchValue_6, declarations.length === 1)) {
160
+ matchResult_1 = 0;
161
+ declarations_1 = matchValue_6;
162
+ }
163
+ else {
164
+ matchResult_1 = 1;
165
+ }
113
166
  }
114
167
  else {
115
- matchResult = 1;
168
+ matchResult_1 = 1;
169
+ }
170
+ switch (matchResult_1) {
171
+ case 0: {
172
+ typ = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadNode6C0FD055"](item(0, declarations_1));
173
+ break;
174
+ }
175
+ default:
176
+ typ = (new GlueType(/* Primitive */ 3, [GluePrimitive.Any]));
116
177
  }
117
178
  }
118
179
  else {
119
- matchResult = 1;
120
- }
121
- switch (matchResult) {
122
- case 0: {
123
- typ = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadNode6C0FD055"](item(0, declarations_1));
124
- break;
125
- }
126
- default:
127
- typ = (new GlueType(/* Primitive */ 3, [GluePrimitive.Any]));
180
+ typ = primitiveOfFlags(tsTyp);
128
181
  }
129
182
  }
130
- else {
131
- typ = primitiveOfFlags(tsTyp);
132
- }
133
183
  }
134
184
  else {
135
185
  const typeNode = declaredTypeNode;
@@ -138,12 +188,12 @@ export function readExportAssignment(reader, exportNode) {
138
188
  const documentation = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadDocumentationFromNode6C0FD055"](exportNode);
139
189
  const isPublished = isDefaultOfVariable && (publishedName != null);
140
190
  const name_2 = isExportEqualsOfVariable ? ("export=" + identiferNode.getText()) : (isPublished ? value_2(publishedName) : (isDefaultOfVariable ? defaultArg(packageName, identiferNode.getText()) : identiferNode.getText()));
141
- const declaration_3 = (typ.tag === 15) ? (isDefaultOfVariable ? (new GlueType(/* FunctionDeclaration */ 6, [new GlueFunctionDeclaration(documentation, true, name_2, typ.fields[0].Type, typ.fields[0].Parameters, typ.fields[0].TypeParameters)])) : (new GlueType(/* Variable */ 2, [new GlueVariable(documentation, name_2, typ)]))) : (new GlueType(/* Variable */ 2, [new GlueVariable(documentation, name_2, typ)]));
191
+ const declaration_6 = (typ.tag === 15) ? (isDefaultOfVariable ? (new GlueType(/* FunctionDeclaration */ 6, [new GlueFunctionDeclaration(documentation, true, name_2, typ.fields[0].Type, typ.fields[0].Parameters, typ.fields[0].TypeParameters)])) : (new GlueType(/* Variable */ 2, [new GlueVariable(documentation, name_2, typ)]))) : (new GlueType(/* Variable */ 2, [new GlueVariable(documentation, name_2, typ)]));
142
192
  if (isPublished) {
143
- return declaration_3;
193
+ return declaration_6;
144
194
  }
145
195
  else {
146
- return new GlueType(/* ExportDefault */ 25, [declaration_3]);
196
+ return new GlueType(/* ExportDefault */ 25, [declaration_6]);
147
197
  }
148
198
  }
149
199
  else {
@@ -154,5 +204,9 @@ export function readExportAssignment(reader, exportNode) {
154
204
  return GlueType.Discard;
155
205
  }
156
206
  }
207
+ else {
208
+ const reExport = importedClass;
209
+ return new GlueType(/* ExportDefault */ 25, [new GlueType(/* ReExport */ 33, [reExport])]);
210
+ }
157
211
  }
158
212
 
@@ -38,7 +38,7 @@ function readReExport(reader, packageContext, currentFile, exportedName, symbol)
38
38
  const kept = tupledArg[0];
39
39
  const hasInterface = tupledArg[1];
40
40
  let matchResult_1;
41
- if (glueType.tag === 32) {
41
+ if (glueType.tag === 33) {
42
42
  if (glueType.fields[0].Declaration.tag === 1) {
43
43
  if (hasInterface) {
44
44
  matchResult_1 = 0;
@@ -83,7 +83,7 @@ function readReExport(reader, packageContext, currentFile, exportedName, symbol)
83
83
  option_1 = undefined;
84
84
  }
85
85
  if (option_1 != null) {
86
- return (declaration_1 = option_1, new GlueType(/* ReExport */ 32, [new GlueReExport(exportedName, reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadNode6C0FD055"](declaration_1), modulePathForDeclaration(packageContext, declaration_1))]));
86
+ return (declaration_1 = option_1, new GlueType(/* ReExport */ 33, [new GlueReExport(exportedName, reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadNode6C0FD055"](declaration_1), modulePathForDeclaration(packageContext, declaration_1))]));
87
87
  }
88
88
  else {
89
89
  return undefined;
@@ -6,7 +6,6 @@ import { concat } from "../../fable_modules/fable-library-js.5.21.0/String.js";
6
6
  import { TypeScript_Ts_SyntaxKind__SyntaxKind_get_Name } from "../TypeScript.Extensions.js";
7
7
 
8
8
  export function readIndexedAccessType(reader, declaration) {
9
- let typeNode;
10
9
  const idxNodeType = declaration.indexType;
11
10
  const withIndexType = (indexType) => (new GlueType(/* IndexedAccessType */ 10, [new GlueIndexedAccessType(indexType, reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNode24A678AD"](declaration.objectType))]));
12
11
  const node = declaration;
@@ -18,73 +17,80 @@ export function readIndexedAccessType(reader, declaration) {
18
17
  return undefined;
19
18
  }
20
19
  };
20
+ const tryResolved = () => {
21
+ let typeNode;
22
+ if (node.pos < 0) {
23
+ return undefined;
24
+ }
25
+ else {
26
+ const checker = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"]();
27
+ const typ_1 = checker.getTypeAtLocation(node);
28
+ const matchValue_1 = typ_1.flags;
29
+ if ($007CHasTypeFlags$007C_$007C(134217728, matchValue_1) != null) {
30
+ const matchValue_2 = tryTypeToTypeNode(typ_1, typeNodeBuilderFlags);
31
+ let matchResult, typeNode_1;
32
+ if (matchValue_2 != null) {
33
+ if ((typeNode = matchValue_2, typeNode.kind === 193)) {
34
+ matchResult = 0;
35
+ typeNode_1 = matchValue_2;
36
+ }
37
+ else {
38
+ matchResult = 1;
39
+ }
40
+ }
41
+ else {
42
+ matchResult = 1;
43
+ }
44
+ switch (matchResult) {
45
+ case 0:
46
+ return reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNode24A678AD"](typeNode_1);
47
+ default:
48
+ return undefined;
49
+ }
50
+ }
51
+ else {
52
+ return undefined;
53
+ }
54
+ }
55
+ };
21
56
  const matchValue_3 = idxNodeType.kind;
22
- let matchResult;
57
+ let matchResult_1;
23
58
  switch (matchValue_3) {
24
59
  case 150:
25
60
  case 154:
26
61
  case 184: {
27
- matchResult = 3;
62
+ matchResult_1 = 3;
63
+ break;
64
+ }
65
+ case 193:
66
+ case 195:
67
+ case 200: {
68
+ matchResult_1 = 5;
28
69
  break;
29
70
  }
30
71
  case 194: {
31
- matchResult = 4;
72
+ matchResult_1 = 4;
32
73
  break;
33
74
  }
34
75
  case 199: {
35
- matchResult = 0;
76
+ matchResult_1 = 0;
36
77
  break;
37
78
  }
38
79
  case 202: {
39
80
  if (node.pos >= 0) {
40
- matchResult = 1;
81
+ matchResult_1 = 1;
41
82
  }
42
83
  else {
43
- matchResult = 2;
84
+ matchResult_1 = 2;
44
85
  }
45
86
  break;
46
87
  }
47
88
  default:
48
- matchResult = 5;
89
+ matchResult_1 = 6;
49
90
  }
50
- switch (matchResult) {
91
+ switch (matchResult_1) {
51
92
  case 0: {
52
- let matchValue_4;
53
- if (node.pos < 0) {
54
- matchValue_4 = undefined;
55
- }
56
- else {
57
- const checker = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"]();
58
- const typ_1 = checker.getTypeAtLocation(node);
59
- const matchValue_1 = typ_1.flags;
60
- if ($007CHasTypeFlags$007C_$007C(134217728, matchValue_1) != null) {
61
- const matchValue_2 = tryTypeToTypeNode(typ_1, typeNodeBuilderFlags);
62
- let matchResult_1, typeNode_1;
63
- if (matchValue_2 != null) {
64
- if ((typeNode = matchValue_2, typeNode.kind === 193)) {
65
- matchResult_1 = 0;
66
- typeNode_1 = matchValue_2;
67
- }
68
- else {
69
- matchResult_1 = 1;
70
- }
71
- }
72
- else {
73
- matchResult_1 = 1;
74
- }
75
- switch (matchResult_1) {
76
- case 0: {
77
- matchValue_4 = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNode24A678AD"](typeNode_1);
78
- break;
79
- }
80
- default:
81
- matchValue_4 = undefined;
82
- }
83
- }
84
- else {
85
- matchValue_4 = undefined;
86
- }
87
- }
93
+ const matchValue_4 = tryResolved();
88
94
  if (matchValue_4 == null) {
89
95
  const typeOperatorNode = declaration.indexType;
90
96
  return withIndexType(reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeOperatorNodeZ6830FC33"](typeOperatorNode));
@@ -119,8 +125,17 @@ export function readIndexedAccessType(reader, declaration) {
119
125
  return withIndexType(reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNode24A678AD"](idxNodeType));
120
126
  case 4:
121
127
  return withIndexType(GlueType.Discard);
128
+ case 5: {
129
+ const option_1 = tryResolved();
130
+ if (option_1 != null) {
131
+ return option_1;
132
+ }
133
+ else {
134
+ return withIndexType(GlueType.Discard);
135
+ }
136
+ }
122
137
  default: {
123
- const warning = Report_readerError_Z19516DCE("readIndexedAccessType", concat("Unsupported node kind ", TypeScript_Ts_SyntaxKind__SyntaxKind_get_Name(matchValue_3)), idxNodeType, "/_//src/Glutinum.Converter/Reader/IndexedAccessType.fs", 87);
138
+ const warning = Report_readerError_Z19516DCE("readIndexedAccessType", concat("Unsupported node kind ", TypeScript_Ts_SyntaxKind__SyntaxKind_get_Name(matchValue_3)), idxNodeType, "/_//src/Glutinum.Converter/Reader/IndexedAccessType.fs", 93);
124
139
  void (reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_Warnings"]().push(warning));
125
140
  return withIndexType(GlueType.Discard);
126
141
  }
@@ -1,6 +1,6 @@
1
1
 
2
- import { isEmpty, tryItem, tryPick, mapIndexed, filter, forAll, cons, map, collect, empty } from "../../fable_modules/fable-library-js.5.21.0/List.js";
3
- import { readHeritageClauses, getFullNameOrEmpty, otherFileInterfaceDeclarations, mainDeclaration } from "./Utils.js";
2
+ import { isEmpty, tryItem, tryPick, mapIndexed, filter, forAll, cons, map, append, collect, empty } from "../../fable_modules/fable-library-js.5.21.0/List.js";
3
+ import { readHeritageClauses, getFullNameOrEmpty, readModuleHeritageMembers, otherFileInterfaceDeclarations, mainDeclaration } from "./Utils.js";
4
4
  import { toList } from "../../fable_modules/fable-library-js.5.21.0/Seq.js";
5
5
  import { defaultArg } from "../../fable_modules/fable-library-js.5.21.0/Option.js";
6
6
  import { GlueReExport, GlueType, GlueInterface, GlueTypeParameter } from "../GlueAST.js";
@@ -40,7 +40,7 @@ export function readInterfaceDeclaration(reader, declaration) {
40
40
  otherDeclarations = empty();
41
41
  }
42
42
  }
43
- const members = collect((declaration_1) => map((declaration_2) => reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadDeclaration61B89E55"](declaration_2), toList(declaration_1.members)), cons(declaration, otherDeclarations));
43
+ const members = collect((declaration_1) => append(readModuleHeritageMembers(reader, declaration_1.heritageClauses), map((declaration_2) => reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadDeclaration61B89E55"](declaration_2), toList(declaration_1.members))), cons(declaration, otherDeclarations));
44
44
  let typeParameters;
45
45
  const own = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeParameters4BD418D9"](declaration.typeParameters);
46
46
  if (forAll((typeParameter) => (typeParameter.Default != null), own)) {
@@ -116,7 +116,7 @@ export function tryReadExternalRedeclaration(reader, declaration, glueInterface)
116
116
  case 0: {
117
117
  const option_4 = tryPick((other) => PackageContext__TryFindExternalModulePath_Z721C83C5(packageContext, other.getSourceFile().fileName), defaultArg((option_1 = symbol.declarations, (option_1 != null) ? toList(option_1) : undefined), empty()));
118
118
  if (option_4 != null) {
119
- return new GlueType(/* ReExport */ 32, [new GlueReExport(glueInterface.Name, new GlueType(/* Interface */ 1, [glueInterface]), option_4)]);
119
+ return new GlueType(/* ReExport */ 33, [new GlueReExport(glueInterface.Name, new GlueType(/* Interface */ 1, [glueInterface]), option_4)]);
120
120
  }
121
121
  else {
122
122
  return undefined;
@@ -1,9 +1,11 @@
1
1
 
2
2
  import { Exception, stringHash, structuralHash, equals, disposeSafe } from "../../fable_modules/fable-library-js.5.21.0/Util.js";
3
- import { head, tail, append, forAll as forAll_1, filter, empty, exists as exists_1, collect, isEmpty, map, concat, choose } from "../../fable_modules/fable-library-js.5.21.0/List.js";
3
+ import { head, tail, append, forAll as forAll_1, empty, exists as exists_1, collect, isEmpty, map, concat, filter, choose } from "../../fable_modules/fable-library-js.5.21.0/List.js";
4
4
  import { readInstantiatedMember, readPropertyWithoutDeclaration, IntersectionTypePropertyResult } from "./MemberTypes.js";
5
5
  import { item } from "../../fable_modules/fable-library-js.5.21.0/Array.js";
6
6
  import { filter as filter_1, exists, toList, forAll } from "../../fable_modules/fable-library-js.5.21.0/Seq.js";
7
+ import { Operators_IsNull } from "../../fable_modules/fable-library-js.5.21.0/FSharp.Core.js";
8
+ import { normalizePath } from "../Utils/String.js";
7
9
  import { List_distinctBy, List_distinct } from "../../fable_modules/fable-library-js.5.21.0/Seq2.js";
8
10
  import { withInProgress, typeNodeBuilderFlags } from "./Utils.js";
9
11
  import { GluePrimitive, GlueType } from "../GlueAST.js";
@@ -20,30 +22,41 @@ function readIntersectionConstituents(reader, typeNode) {
20
22
  },
21
23
  };
22
24
  try {
23
- const properties_1 = choose((property_1) => {
24
- const matchValue_1 = property_1.declarations;
25
- if (matchValue_1 == null) {
26
- return new IntersectionTypePropertyResult(/* WithoutDeclaration */ 1, [property_1]);
25
+ const properties_1 = choose((property_2) => {
26
+ const matchValue_2 = property_2.declarations;
27
+ if (matchValue_2 == null) {
28
+ return new IntersectionTypePropertyResult(/* WithoutDeclaration */ 1, [property_2]);
27
29
  }
28
30
  else {
29
- const declarations = matchValue_1;
30
- if (declarations.length === 1) {
31
- return new IntersectionTypePropertyResult(/* Single */ 0, [property_1, item(0, declarations)]);
31
+ const declarations_2 = matchValue_2;
32
+ if (declarations_2.length === 1) {
33
+ return new IntersectionTypePropertyResult(/* Single */ 0, [property_2, item(0, declarations_2)]);
32
34
  }
33
- else if (forAll((declaration) => {
34
- if (declaration.kind === 172) {
35
+ else if (forAll((declaration_1) => {
36
+ if (declaration_1.kind === 172) {
35
37
  return true;
36
38
  }
37
39
  else {
38
- return declaration.kind === 173;
40
+ return declaration_1.kind === 173;
39
41
  }
40
- }, declarations)) {
41
- return new IntersectionTypePropertyResult(/* WithoutDeclaration */ 1, [property_1]);
42
+ }, declarations_2)) {
43
+ return new IntersectionTypePropertyResult(/* WithoutDeclaration */ 1, [property_2]);
42
44
  }
43
45
  else {
44
46
  return IntersectionTypePropertyResult.ForceAny;
45
47
  }
46
48
  }
49
+ }, filter((arg_1) => {
50
+ let matchValue_1, declarations, declarations_1;
51
+ return !((matchValue_1 = arg_1.declarations, (matchValue_1 != null) && (((declarations = matchValue_1, declarations.length > 0)) && ((declarations_1 = matchValue_1, forAll((declaration) => {
52
+ const parent = declaration.parent;
53
+ if ((!Operators_IsNull(parent) && (parent.kind === 265)) && (parent.name.text === "Object")) {
54
+ return normalizePath(declaration.getSourceFile().fileName).indexOf("/lib.es") >= 0;
55
+ }
56
+ else {
57
+ return false;
58
+ }
59
+ }, declarations_1))))));
47
60
  }, unionOrIntersectionType.isUnion() ? List_distinct(concat(map((arg) => toList(checker.getPropertiesOfType(arg)), toList(unionOrIntersectionType.types))), {
48
61
  Equals: equals,
49
62
  GetHashCode: (x) => (structuralHash(x) | 0),
@@ -53,16 +66,16 @@ function readIntersectionConstituents(reader, typeNode) {
53
66
  }, toList(intersectionTypeNode.types)), {
54
67
  Equals: (x_1, y_1) => (x_1 === y_1),
55
68
  GetHashCode: (x_1) => (stringHash(x_1) | 0),
56
- }) : matchValue) : matchValue)));
69
+ }) : matchValue) : matchValue))));
57
70
  const intersectsATypeQuery = exists((constituent_1) => (constituent_1.kind === 187), intersectionTypeNode.types);
58
71
  const everyConstituentIsAReference = forAll((constituent_2) => (constituent_2.kind === 184), intersectionTypeNode.types);
59
- const hasUnsupportedProperties = intersectsATypeQuery ? true : exists_1((property_2) => {
60
- switch (property_2.tag) {
72
+ const hasUnsupportedProperties = intersectsATypeQuery ? true : exists_1((property_3) => {
73
+ switch (property_3.tag) {
61
74
  case 1:
62
75
  return false;
63
76
  case 0:
64
77
  if (everyConstituentIsAReference) {
65
- return property_2.fields[1].kind === 175;
78
+ return property_3.fields[1].kind === 175;
66
79
  }
67
80
  else {
68
81
  return false;
@@ -77,12 +90,12 @@ function readIntersectionConstituents(reader, typeNode) {
77
90
  return undefined;
78
91
  }
79
92
  else {
80
- const declaration_2 = synthesized;
81
- declaration_2.parent = typeNode;
93
+ const declaration_3 = synthesized;
94
+ declaration_3.parent = typeNode;
82
95
  const previousContext = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_SyntheticContext"]();
83
- reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.set_SyntheticContext"](declaration_2);
96
+ reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.set_SyntheticContext"](declaration_3);
84
97
  try {
85
- return reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadDeclaration61B89E55"](declaration_2);
98
+ return reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadDeclaration61B89E55"](declaration_3);
86
99
  }
87
100
  finally {
88
101
  reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.set_SyntheticContext"](previousContext);
@@ -100,9 +113,9 @@ function readIntersectionConstituents(reader, typeNode) {
100
113
  }, toList(intersectionTypeNode.types));
101
114
  const literalMembers = collect((constituent_4) => {
102
115
  if (constituent_4.kind === 188) {
103
- const matchValue_2 = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNode24A678AD"](constituent_4);
104
- if (matchValue_2.tag === 22) {
105
- return matchValue_2.fields[0].Members;
116
+ const matchValue_3 = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNode24A678AD"](constituent_4);
117
+ if (matchValue_3.tag === 22) {
118
+ return matchValue_3.fields[0].Members;
106
119
  }
107
120
  else {
108
121
  return empty();
@@ -134,7 +147,7 @@ function readIntersectionConstituents(reader, typeNode) {
134
147
  }
135
148
  }, properties_1)), append(callSignatures, collect((constituent_5) => {
136
149
  if (constituent_5.kind === 188) {
137
- return map((declaration_4) => reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadDeclaration61B89E55"](declaration_4), filter((element) => (element.kind === 182), toList(constituent_5.members)));
150
+ return map((declaration_5) => reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadDeclaration61B89E55"](declaration_5), filter((element) => (element.kind === 182), toList(constituent_5.members)));
138
151
  }
139
152
  else {
140
153
  return empty();
@@ -6,6 +6,7 @@ import { ts } from "@ts-morph/bootstrap";
6
6
  import { FSharpResult$2 } from "../../fable_modules/fable-library-js.5.21.0/Result.js";
7
7
  import { Report_readerError_Z19516DCE } from "./Report.js";
8
8
  import { head, tail, isEmpty, length } from "../../fable_modules/fable-library-js.5.21.0/List.js";
9
+ import { readParameterFreeMappedAlias, tryParameterFreeMappedAlias } from "./UtilityType.js";
9
10
  import { GlueType, GlueMappedType } from "../GlueAST.js";
10
11
 
11
12
  function tryIdentitySource(reader, mappedTypeNode) {
@@ -83,9 +84,9 @@ function tryIdentitySource(reader, mappedTypeNode) {
83
84
  }
84
85
 
85
86
  export function readMappedTypeNode(reader, mappedTypeNode) {
86
- let matchValue, input_1, typNode;
87
+ let parameterFreeAlias, input_1, matchValue, input_3, typNode;
87
88
  let _arg_1;
88
- let input_2;
89
+ let input_4;
89
90
  const typeParameters = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeParameters4BD418D9"]((ts.factory).createNodeArray([mappedTypeNode.typeParameter]));
90
91
  let matchResult, tp;
91
92
  if (!isEmpty(typeParameters)) {
@@ -102,13 +103,13 @@ export function readMappedTypeNode(reader, mappedTypeNode) {
102
103
  }
103
104
  switch (matchResult) {
104
105
  case 0: {
105
- input_2 = (new FSharpResult$2(/* Ok */ 0, [tp]));
106
+ input_4 = (new FSharpResult$2(/* Ok */ 0, [tp]));
106
107
  break;
107
108
  }
108
109
  default:
109
- input_2 = (new FSharpResult$2(/* Error */ 1, [Report_readerError_Z19516DCE("readMappedTypeNode", `Expected exactly one type parameter but was ${length(typeParameters)}`, mappedTypeNode, "/_//src/Glutinum.Converter/Reader/MappedTypeNode.fs", 60)]));
110
+ input_4 = (new FSharpResult$2(/* Error */ 1, [Report_readerError_Z19516DCE("readMappedTypeNode", `Expected exactly one type parameter but was ${length(typeParameters)}`, mappedTypeNode, "/_//src/Glutinum.Converter/Reader/MappedTypeNode.fs", 60)]));
110
111
  }
111
- _arg_1 = ((input_2.tag === 1) ? (new FSharpResult$2(/* Error */ 1, [input_2.fields[0]])) : (new FSharpResult$2(/* Ok */ 0, [(matchValue = tryIdentitySource(reader, mappedTypeNode), (matchValue == null) ? (new GlueType(/* MappedType */ 28, [new GlueMappedType(input_2.fields[0], (input_1 = mappedTypeNode.type, (input_1 == null) ? undefined : ((typNode = input_1, reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNode24A678AD"](typNode)))))])) : matchValue)])));
112
+ _arg_1 = ((input_4.tag === 1) ? (new FSharpResult$2(/* Error */ 1, [input_4.fields[0]])) : (new FSharpResult$2(/* Ok */ 0, [(parameterFreeAlias = ((input_1 = tryParameterFreeMappedAlias(mappedTypeNode.parent), (input_1 == null) ? undefined : readParameterFreeMappedAlias(reader, input_1))), (matchValue = tryIdentitySource(reader, mappedTypeNode), (matchValue == null) ? ((parameterFreeAlias == null) ? (new GlueType(/* MappedType */ 28, [new GlueMappedType(input_4.fields[0], (input_3 = mappedTypeNode.type, (input_3 == null) ? undefined : ((typNode = input_3, reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadTypeNode24A678AD"](typNode)))))])) : parameterFreeAlias) : matchValue))])));
112
113
  if (_arg_1.tag === 1) {
113
114
  void (reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_Warnings"]().push(_arg_1.fields[0]));
114
115
  return GlueType.Discard;
@@ -44,7 +44,7 @@ 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 = 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);
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 */ 33, [new GlueReExport(moduleExportNameText(exportSpecifier.name), declaration_1, empty())]))))))) : undefined) : undefined))) : undefined), GlueType.Discard);
48
48
  }
49
49
  default: {
50
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);