@glutinum/cli 1.0.0-beta.6 → 1.0.0-beta.7
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/Packages.js +1 -1
- package/dist/Glutinum.Converter/Read.js +103 -140
- 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 +76 -22
- package/dist/Glutinum.Converter/Reader/TypeOperatorNode.js +53 -14
- package/dist/Glutinum.Converter/Reader/Types.js +5 -0
- package/dist/Glutinum.Converter/Reader/Utils.js +62 -31
- package/dist/Glutinum.Converter/Transform.js +98 -109
- package/dist/Glutinum.Converter/Transformer/Conditionals.js +2 -64
- package/dist/Glutinum.Converter/Transformer/Context.js +23 -10
- package/dist/Glutinum.Converter/Transformer/Heritage.js +89 -2
- 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 {
|
|
@@ -440,7 +440,7 @@ function keepIncluded(included, types) {
|
|
|
440
440
|
return undefined;
|
|
441
441
|
}
|
|
442
442
|
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)]);
|
|
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].IsExported, glueType.fields[0].IsRecursive, matchValue_1)]);
|
|
444
444
|
}
|
|
445
445
|
}
|
|
446
446
|
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
|
}
|
|
@@ -1,13 +1,31 @@
|
|
|
1
1
|
|
|
2
2
|
import { choose, concat, toList, exists } from "../../fable_modules/fable-library-js.5.17.2/Seq.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { isExportedDeclaration, isGlobalAugmentation, isTopLevelModuleDeclaration, isMergedInterfaceDeclaration, identifierText } from "./Utils.js";
|
|
4
|
+
import { ofSeq, filter, empty, map, collect, singleton } from "../../fable_modules/fable-library-js.5.17.2/List.js";
|
|
5
|
+
import { singleton as singleton_1 } from "../../fable_modules/fable-library-js.5.17.2/Set.js";
|
|
6
|
+
import { comparePrimitives } from "../../fable_modules/fable-library-js.5.17.2/Util.js";
|
|
5
7
|
import { GlueModuleDeclaration } from "../GlueAST.js";
|
|
6
8
|
|
|
7
9
|
export function readModuleDeclaration(reader, declaration) {
|
|
8
10
|
const name = declaration.name;
|
|
9
11
|
const children = declaration.getChildren();
|
|
10
|
-
const
|
|
12
|
+
const isBodyOfDottedName = (declaration.parent.kind === 268) && (declaration.parent.body === declaration);
|
|
13
|
+
const isNamespace = isBodyOfDottedName ? true : exists((node) => (node.kind === 145), children);
|
|
14
|
+
const isAmbientModule = declaration.name.kind === 11;
|
|
15
|
+
const isExportAssigned = exists((statement) => {
|
|
16
|
+
if (statement.kind === 278) {
|
|
17
|
+
const expression = statement.expression;
|
|
18
|
+
if (expression.kind === 80) {
|
|
19
|
+
return identifierText(expression) === name.getText();
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
return false;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
return false;
|
|
27
|
+
}
|
|
28
|
+
}, declaration.getSourceFile().statements);
|
|
11
29
|
const types = toList(concat(choose((child) => {
|
|
12
30
|
const matchValue = child.kind;
|
|
13
31
|
switch (matchValue) {
|
|
@@ -15,12 +33,42 @@ export function readModuleDeclaration(reader, declaration) {
|
|
|
15
33
|
return singleton(reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadNode6C0FD055"](child));
|
|
16
34
|
case 269: {
|
|
17
35
|
const moduleBlock = child;
|
|
18
|
-
return
|
|
36
|
+
return collect((statement_2) => {
|
|
37
|
+
let exportClause;
|
|
38
|
+
if (statement_2.kind === 279) {
|
|
39
|
+
const exportDeclaration = statement_2;
|
|
40
|
+
const matchValue_2 = exportDeclaration.exportClause;
|
|
41
|
+
let matchResult, exportClause_1;
|
|
42
|
+
if (matchValue_2 != null) {
|
|
43
|
+
if ((exportClause = matchValue_2, (exportDeclaration.moduleSpecifier == null) && (exportClause.kind === 280))) {
|
|
44
|
+
matchResult = 0;
|
|
45
|
+
exportClause_1 = matchValue_2;
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
matchResult = 1;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
matchResult = 1;
|
|
53
|
+
}
|
|
54
|
+
switch (matchResult) {
|
|
55
|
+
case 0:
|
|
56
|
+
return map((node_1) => reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadNode6C0FD055"](node_1), toList(exportClause_1.elements));
|
|
57
|
+
default:
|
|
58
|
+
return empty();
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
return singleton(reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadNode6C0FD055"](statement_2));
|
|
63
|
+
}
|
|
64
|
+
}, filter((statement_1) => !isMergedInterfaceDeclaration(reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_checker"](), reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_PackageContext"](), statement_1), ofSeq(moduleBlock.statements)));
|
|
19
65
|
}
|
|
20
66
|
default:
|
|
21
67
|
return undefined;
|
|
22
68
|
}
|
|
23
69
|
}, children)));
|
|
24
|
-
return new GlueModuleDeclaration(reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadDocumentationFromNode6C0FD055"](declaration), name.getText(), isTopLevelModuleDeclaration(reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_PackageContext"](), declaration), isNamespace, (reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_PackageContext"]() != null) && isGlobalAugmentation(declaration),
|
|
70
|
+
return new GlueModuleDeclaration(reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadDocumentationFromNode6C0FD055"](declaration), name.getText(), isTopLevelModuleDeclaration(reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_PackageContext"](), declaration), isNamespace, (reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_PackageContext"]() != null) && isGlobalAugmentation(declaration), ((isAmbientModule ? true : isBodyOfDottedName) ? true : isExportAssigned) ? true : isExportedDeclaration(declaration, singleton_1(name.getText(), {
|
|
71
|
+
Compare: (x, y) => (comparePrimitives(x, y) | 0),
|
|
72
|
+
})), false, types);
|
|
25
73
|
}
|
|
26
74
|
|
|
@@ -9,7 +9,7 @@ import { concat } from "../../fable_modules/fable-library-js.5.17.2/String.js";
|
|
|
9
9
|
import { TypeScript_Ts_SyntaxKind__SyntaxKind_get_Name } from "../TypeScript.Extensions.js";
|
|
10
10
|
|
|
11
11
|
export function readNode(reader, node) {
|
|
12
|
-
let option_3, option, binder, checker, option_1, target, matchValue_1, declarations, declarations_1, declaration, matchValue_2;
|
|
12
|
+
let option_3, option, binder, checker, option_1, target, matchValue_1, declarations, declarations_1, declaration, declaration_1, matchValue_2;
|
|
13
13
|
const matchValue = node.kind;
|
|
14
14
|
switch (matchValue) {
|
|
15
15
|
case 136:
|
|
@@ -44,10 +44,10 @@ 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 = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.ReadNode6C0FD055"](
|
|
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);
|
|
48
48
|
}
|
|
49
49
|
default: {
|
|
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",
|
|
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);
|
|
51
51
|
void (reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_Warnings"]().push(warning));
|
|
52
52
|
return GlueType.Discard;
|
|
53
53
|
}
|
|
@@ -18,12 +18,13 @@ export function readParameters(reader, parameters) {
|
|
|
18
18
|
name = identifierText(nameNode_1);
|
|
19
19
|
break;
|
|
20
20
|
}
|
|
21
|
-
case 207:
|
|
21
|
+
case 207:
|
|
22
|
+
case 208: {
|
|
22
23
|
name = (`arg${index}`);
|
|
23
24
|
break;
|
|
24
25
|
}
|
|
25
26
|
default: {
|
|
26
|
-
const item = Report_readerError_Z19516DCE("name", concat_1("Unsupported kind ", TypeScript_Ts_SyntaxKind__SyntaxKind_get_Name(nameNode_1.kind)), nameNode_1, "/_//src/Glutinum.Converter/Reader/Parameters.fs",
|
|
27
|
+
const item = Report_readerError_Z19516DCE("name", concat_1("Unsupported kind ", TypeScript_Ts_SyntaxKind__SyntaxKind_get_Name(nameNode_1.kind)), nameNode_1, "/_//src/Glutinum.Converter/Reader/Parameters.fs", 36);
|
|
27
28
|
const objectArg = reader["Glutinum.Converter.Reader.Types.ITypeScriptReader.get_Warnings"]();
|
|
28
29
|
void (objectArg.push(item));
|
|
29
30
|
name = (`arg${index}`);
|