@glutinum/cli 1.0.0-beta.6 → 1.0.0-beta.8
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.
- package/dist/Glutinum.Converter/GlueAST.js +3 -2
- package/dist/Glutinum.Converter/Hosting.js +2 -2
- package/dist/Glutinum.Converter/Packages.js +13 -22
- package/dist/Glutinum.Converter/Read.js +103 -140
- package/dist/Glutinum.Converter/Reader/ConditionalTypeNode.js +90 -0
- package/dist/Glutinum.Converter/Reader/Deferred.js +706 -0
- package/dist/Glutinum.Converter/Reader/ExpressionWithTypeArguments.js +59 -0
- package/dist/Glutinum.Converter/Reader/IntersectionTypeNode.js +178 -0
- package/dist/Glutinum.Converter/Reader/MemberTypes.js +126 -0
- package/dist/Glutinum.Converter/Reader/ModuleDeclaration.js +53 -5
- package/dist/Glutinum.Converter/Reader/Node.js +3 -3
- package/dist/Glutinum.Converter/Reader/Parameters.js +3 -2
- package/dist/Glutinum.Converter/Reader/TypeNode.js +102 -1941
- package/dist/Glutinum.Converter/Reader/TypeOperatorNode.js +53 -14
- package/dist/Glutinum.Converter/Reader/Types.js +5 -0
- package/dist/Glutinum.Converter/Reader/UtilityType.js +803 -0
- package/dist/Glutinum.Converter/Reader/Utils.js +149 -78
- package/dist/Glutinum.Converter/Transform.js +274 -1163
- package/dist/Glutinum.Converter/Transformer/Conditionals.js +2 -64
- package/dist/Glutinum.Converter/Transformer/Context.js +23 -10
- package/dist/Glutinum.Converter/Transformer/Exports.js +704 -0
- package/dist/Glutinum.Converter/Transformer/Heritage.js +89 -2
- package/dist/Glutinum.Converter/Transformer/TypeParameter.js +219 -0
- package/package.json +1 -1
|
@@ -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 {
|
|
@@ -444,7 +444,7 @@ function Resolve_satisfiesComparator(version, comparator) {
|
|
|
444
444
|
}
|
|
445
445
|
}
|
|
446
446
|
|
|
447
|
-
function Resolve_satisfiesRange(version, range) {
|
|
447
|
+
export function Resolve_satisfiesRange(version, range) {
|
|
448
448
|
const parsed = Resolve_parseVersion(version);
|
|
449
449
|
const array_1 = split_1(range, ["||"], undefined, 0);
|
|
450
450
|
return array_1.some((alternative) => {
|
|
@@ -453,7 +453,7 @@ function Resolve_satisfiesRange(version, range) {
|
|
|
453
453
|
});
|
|
454
454
|
}
|
|
455
455
|
|
|
456
|
-
function Resolve_applyTypesVersions(typesVersions, file) {
|
|
456
|
+
export function Resolve_applyTypesVersions(typesVersions, file) {
|
|
457
457
|
if (typesVersions === null || typesVersions === undefined) {
|
|
458
458
|
return file;
|
|
459
459
|
}
|
|
@@ -13,8 +13,8 @@ import { contains, sortBy, tryFind as tryFind_1, collect, toArray, singleton, is
|
|
|
13
13
|
import { add, ofSeq as ofSeq_1, toList, FSharpMap__TryFind, FSharpMap__ContainsKey, FSharpMap__Add, containsKey, empty } from "../fable_modules/fable-library-js.5.17.2/Map.js";
|
|
14
14
|
import { PackageContext__TryFindPackage_Z721C83C5, PackageContext, ExternalPackage, PackageInfo } from "./Reader/Types.js";
|
|
15
15
|
import { choose as choose_1, singleton as singleton_1, collect as collect_1, empty as empty_3, append as append_1, delay, sort as sort_1, toList as toList_1, exists, filter, tryPick, map as map_2, tryFind, fold as fold_1 } from "../fable_modules/fable-library-js.5.17.2/Seq.js";
|
|
16
|
-
import { ambientModuleSpecifier, promotedAmbientModule, ambientModuleNames, $007CHasSymbolFlags$007C_$007C } from "./Reader/Utils.js";
|
|
17
16
|
import { toArray as toArray_1, defaultArg } from "../fable_modules/fable-library-js.5.17.2/Option.js";
|
|
17
|
+
import { ambientModuleSpecifier, promotedAmbientModule, ambientModuleNames, $007CHasSymbolFlags$007C_$007C, resolveAlias } from "./Reader/Utils.js";
|
|
18
18
|
import { defaultMaxOverloads } from "./Transformer/UnionOverloads.js";
|
|
19
19
|
import { List_distinctBy, List_distinct } from "../fable_modules/fable-library-js.5.17.2/Seq2.js";
|
|
20
20
|
import { readPackages } from "./Read.js";
|
|
@@ -109,18 +109,9 @@ function reExportedNames(program, checker, hasExportsMap, package$) {
|
|
|
109
109
|
}
|
|
110
110
|
}
|
|
111
111
|
|
|
112
|
-
function resolveAlias(checker, symbol) {
|
|
113
|
-
const matchValue = symbol.flags;
|
|
114
|
-
if ($007CHasSymbolFlags$007C_$007C(2097152, matchValue) != null) {
|
|
115
|
-
return checker.getAliasedSymbol(symbol);
|
|
116
|
-
}
|
|
117
|
-
else {
|
|
118
|
-
return symbol;
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
|
|
122
112
|
function defaultExportOf(program, checker, fileName) {
|
|
123
|
-
let
|
|
113
|
+
let symbol;
|
|
114
|
+
let option_6;
|
|
124
115
|
let option_3;
|
|
125
116
|
const option_1 = program.getSourceFile(fileName);
|
|
126
117
|
if (option_1 != null) {
|
|
@@ -132,13 +123,13 @@ function defaultExportOf(program, checker, fileName) {
|
|
|
132
123
|
}
|
|
133
124
|
if (option_3 != null) {
|
|
134
125
|
const moduleSymbol = option_3;
|
|
135
|
-
|
|
126
|
+
option_6 = tryFind((exported) => (exported.name === "default"), checker.getExportsOfModule(moduleSymbol));
|
|
136
127
|
}
|
|
137
128
|
else {
|
|
138
|
-
|
|
129
|
+
option_6 = undefined;
|
|
139
130
|
}
|
|
140
|
-
if (
|
|
141
|
-
return resolveAlias(checker,
|
|
131
|
+
if (option_6 != null) {
|
|
132
|
+
return (symbol = option_6, defaultArg(resolveAlias(checker, symbol), symbol));
|
|
142
133
|
}
|
|
143
134
|
else {
|
|
144
135
|
return undefined;
|
|
@@ -168,7 +159,7 @@ function reExportedSymbols(program, checker, hasExportsMap, package$) {
|
|
|
168
159
|
const tupledArg_3 = acc;
|
|
169
160
|
return fold_1((acc_1, exportedSymbol) => {
|
|
170
161
|
const exportName = exportedSymbol.name;
|
|
171
|
-
const exportedSymbol_1 = resolveAlias(checker, exportedSymbol);
|
|
162
|
+
const exportedSymbol_1 = defaultArg(resolveAlias(checker, exportedSymbol), exportedSymbol);
|
|
172
163
|
const matchValue_2 = exportedSymbol_1.declarations;
|
|
173
164
|
if (matchValue_2 != null) {
|
|
174
165
|
const tupledArg_2 = acc_1;
|
|
@@ -222,11 +213,11 @@ function declaredNames(program, checker, defaultExportNames, fileName) {
|
|
|
222
213
|
const moduleSymbol = matchValue_1;
|
|
223
214
|
const normalized = normalizePath(fileName);
|
|
224
215
|
return ofSeq(map_2((exportedSymbol_2) => {
|
|
225
|
-
let
|
|
216
|
+
let option_2;
|
|
226
217
|
if (exportedSymbol_2.name === "default") {
|
|
227
218
|
const matchValue_4 = FSharpMap__TryFind(defaultExportNames, normalized);
|
|
228
219
|
if (matchValue_4 == null) {
|
|
229
|
-
return defaultArg((
|
|
220
|
+
return defaultArg((option_2 = exportedSymbol_2.declarations, (option_2 != null) ? tryPick((declaration_1) => {
|
|
230
221
|
const matchValue_5 = declaration_1.name;
|
|
231
222
|
if (equals(matchValue_5, defaultOf())) {
|
|
232
223
|
return undefined;
|
|
@@ -234,7 +225,7 @@ function declaredNames(program, checker, defaultExportNames, fileName) {
|
|
|
234
225
|
else {
|
|
235
226
|
return matchValue_5.getText();
|
|
236
227
|
}
|
|
237
|
-
},
|
|
228
|
+
}, option_2) : undefined), exportedSymbol_2.name);
|
|
238
229
|
}
|
|
239
230
|
else {
|
|
240
231
|
return matchValue_4;
|
|
@@ -244,7 +235,7 @@ function declaredNames(program, checker, defaultExportNames, fileName) {
|
|
|
244
235
|
return exportedSymbol_2.name;
|
|
245
236
|
}
|
|
246
237
|
}, filter((exportedSymbol_1) => {
|
|
247
|
-
const matchValue_3 = resolveAlias(checker, exportedSymbol_1).declarations;
|
|
238
|
+
const matchValue_3 = defaultArg(resolveAlias(checker, exportedSymbol_1), exportedSymbol_1).declarations;
|
|
248
239
|
if (matchValue_3 == null) {
|
|
249
240
|
return false;
|
|
250
241
|
}
|
|
@@ -440,7 +431,7 @@ function keepIncluded(included, types) {
|
|
|
440
431
|
return undefined;
|
|
441
432
|
}
|
|
442
433
|
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)]);
|
|
434
|
+
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
435
|
}
|
|
445
436
|
}
|
|
446
437
|
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,
|
|
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(
|
|
48
|
+
const localKeys = ofSeq(collect((glueType) => {
|
|
49
49
|
if (glueType.tag === 32) {
|
|
50
|
-
return
|
|
50
|
+
return empty();
|
|
51
51
|
}
|
|
52
52
|
else {
|
|
53
|
-
|
|
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
|
|
81
|
-
if (
|
|
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 =
|
|
91
|
-
const
|
|
92
|
-
if (FSharpSet__Contains(localKeys,
|
|
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
|
|
97
|
-
if (
|
|
98
|
-
return [add(
|
|
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 =
|
|
101
|
-
const modulePath_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, [
|
|
124
|
+
}, types, [empty_1({
|
|
114
125
|
Compare: (x_2, y_2) => (compareArrays(x_2, y_2) | 0),
|
|
115
|
-
}),
|
|
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, "",
|
|
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
|
-
}, [
|
|
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
|
|
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]] : [
|
|
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],
|
|
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
|
|
296
|
-
|
|
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
|
|
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 = [
|
|
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,
|
|
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,
|
|
369
|
-
patternInput_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
|
|
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 = (
|
|
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,
|
|
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(
|
|
344
|
+
if (isEmpty(types_3)) {
|
|
382
345
|
return undefined;
|
|
383
346
|
}
|
|
384
347
|
else {
|
|
385
|
-
return fileModule(
|
|
348
|
+
return fileModule(types_3);
|
|
386
349
|
}
|
|
387
350
|
}
|
|
388
351
|
else {
|
|
389
|
-
const patternInput_3 = partition((
|
|
390
|
-
const matchValue_2 = declarationKey((
|
|
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((
|
|
406
|
-
let
|
|
407
|
-
let
|
|
408
|
-
switch (
|
|
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(
|
|
411
|
-
|
|
412
|
-
|
|
373
|
+
if (isUnexported(_arg.fields[0].Name)) {
|
|
374
|
+
matchResult = 0;
|
|
375
|
+
info_3 = _arg.fields[0];
|
|
413
376
|
}
|
|
414
377
|
else {
|
|
415
|
-
|
|
378
|
+
matchResult = 4;
|
|
416
379
|
}
|
|
417
380
|
break;
|
|
418
381
|
}
|
|
419
382
|
case 6: {
|
|
420
|
-
if (isUnexported(
|
|
421
|
-
|
|
422
|
-
|
|
383
|
+
if (isUnexported(_arg.fields[0].Name)) {
|
|
384
|
+
matchResult = 1;
|
|
385
|
+
info_4 = _arg.fields[0];
|
|
423
386
|
}
|
|
424
387
|
else {
|
|
425
|
-
|
|
388
|
+
matchResult = 4;
|
|
426
389
|
}
|
|
427
390
|
break;
|
|
428
391
|
}
|
|
429
392
|
case 2: {
|
|
430
|
-
if (isUnexported(
|
|
431
|
-
|
|
432
|
-
|
|
393
|
+
if (isUnexported(_arg.fields[0].Name)) {
|
|
394
|
+
matchResult = 2;
|
|
395
|
+
info_5 = _arg.fields[0];
|
|
433
396
|
}
|
|
434
397
|
else {
|
|
435
|
-
|
|
398
|
+
matchResult = 4;
|
|
436
399
|
}
|
|
437
400
|
break;
|
|
438
401
|
}
|
|
439
402
|
case 25: {
|
|
440
|
-
switch (
|
|
403
|
+
switch (_arg.fields[0].tag) {
|
|
441
404
|
case 6: {
|
|
442
405
|
if (isUnexported("default")) {
|
|
443
|
-
|
|
406
|
+
matchResult = 3;
|
|
444
407
|
}
|
|
445
408
|
else {
|
|
446
|
-
|
|
409
|
+
matchResult = 4;
|
|
447
410
|
}
|
|
448
411
|
break;
|
|
449
412
|
}
|
|
450
413
|
case 2: {
|
|
451
414
|
if (isUnexported("default")) {
|
|
452
|
-
|
|
415
|
+
matchResult = 3;
|
|
453
416
|
}
|
|
454
417
|
else {
|
|
455
|
-
|
|
418
|
+
matchResult = 4;
|
|
456
419
|
}
|
|
457
420
|
break;
|
|
458
421
|
}
|
|
459
422
|
default:
|
|
460
|
-
|
|
423
|
+
matchResult = 4;
|
|
461
424
|
}
|
|
462
425
|
break;
|
|
463
426
|
}
|
|
464
427
|
default:
|
|
465
|
-
|
|
428
|
+
matchResult = 4;
|
|
466
429
|
}
|
|
467
|
-
switch (
|
|
430
|
+
switch (matchResult) {
|
|
468
431
|
case 0:
|
|
469
|
-
return new GlueType(/* ClassDeclaration */ 12, [new GlueClassDeclaration(
|
|
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
|
|
478
|
-
if (
|
|
479
|
-
if ((
|
|
480
|
-
|
|
481
|
-
|
|
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
|
-
|
|
485
|
-
|
|
447
|
+
matchResult_1 = 1;
|
|
448
|
+
glueType = _arg;
|
|
486
449
|
}
|
|
487
450
|
}
|
|
488
451
|
else {
|
|
489
|
-
|
|
490
|
-
|
|
452
|
+
matchResult_1 = 1;
|
|
453
|
+
glueType = _arg;
|
|
491
454
|
}
|
|
492
|
-
switch (
|
|
455
|
+
switch (matchResult_1) {
|
|
493
456
|
case 0:
|
|
494
|
-
return new GlueType(/* ModuleDeclaration */ 11, [new GlueModuleDeclaration(
|
|
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
|
|
459
|
+
return glueType;
|
|
497
460
|
}
|
|
498
461
|
}
|
|
499
462
|
}
|
|
500
|
-
},
|
|
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((
|
|
536
|
-
if (
|
|
498
|
+
const entryIsGlobal = exists((_arg_2) => {
|
|
499
|
+
if (_arg_2.tag === 1) {
|
|
537
500
|
return false;
|
|
538
501
|
}
|
|
539
502
|
else {
|
|
540
|
-
return
|
|
503
|
+
return _arg_2.fields[0][1];
|
|
541
504
|
}
|
|
542
505
|
}, entryTypes);
|
|
543
|
-
const entryTypes_1 = dropShadowedReExports(append(collect((
|
|
544
|
-
if (
|
|
545
|
-
return
|
|
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
|
|
511
|
+
return _arg_3.fields[0][0];
|
|
549
512
|
}
|
|
550
513
|
}, entryTypes), ofSeq_1(hoistedTypes)));
|
|
551
|
-
const fileModules_2 = nestByName(choose((
|
|
552
|
-
let
|
|
553
|
-
if (
|
|
554
|
-
if (
|
|
555
|
-
|
|
556
|
-
fileModule_1 =
|
|
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
|
-
|
|
522
|
+
matchResult_2 = 1;
|
|
560
523
|
}
|
|
561
524
|
}
|
|
562
525
|
else {
|
|
563
|
-
|
|
526
|
+
matchResult_2 = 1;
|
|
564
527
|
}
|
|
565
|
-
switch (
|
|
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) ?
|
|
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
|
}
|