@glutinum/cli 1.0.0-beta.1 → 1.0.0-beta.10
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/README.md +16 -0
- package/dist/Glutinum.Converter/Abbreviations.js +9 -32
- package/dist/Glutinum.Converter/DelegateExtensions.js +378 -0
- package/dist/Glutinum.Converter/FreeTypeParameters.js +211 -0
- package/dist/Glutinum.Converter/FsharpAST.js +116 -65
- package/dist/Glutinum.Converter/Generate.js +38 -25
- package/dist/Glutinum.Converter/GlueAST.js +82 -43
- package/dist/Glutinum.Converter/Hosting.js +143 -169
- package/dist/Glutinum.Converter/Merge.js +369 -337
- package/dist/Glutinum.Converter/Packages.js +384 -94
- package/dist/Glutinum.Converter/Printer.js +432 -393
- package/dist/Glutinum.Converter/Read.js +361 -99
- package/dist/Glutinum.Converter/Reader/ClassDeclaration.js +4 -4
- package/dist/Glutinum.Converter/Reader/ConditionalTypeNode.js +90 -0
- package/dist/Glutinum.Converter/Reader/Declaration.js +6 -12
- package/dist/Glutinum.Converter/Reader/Deferred.js +706 -0
- package/dist/Glutinum.Converter/Reader/Documentation.js +23 -35
- package/dist/Glutinum.Converter/Reader/ExportAssignment.js +103 -36
- package/dist/Glutinum.Converter/Reader/ExportDeclaration.js +21 -36
- package/dist/Glutinum.Converter/Reader/ExpressionWithTypeArguments.js +59 -0
- package/dist/Glutinum.Converter/Reader/FunctionDeclaration.js +26 -13
- package/dist/Glutinum.Converter/Reader/IndexedAccessType.js +15 -21
- package/dist/Glutinum.Converter/Reader/InterfaceDeclaration.js +45 -2
- 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 +8 -11
- package/dist/Glutinum.Converter/Reader/Parameters.js +36 -27
- package/dist/Glutinum.Converter/Reader/TypeNode.js +389 -1583
- package/dist/Glutinum.Converter/Reader/TypeOperatorNode.js +76 -49
- package/dist/Glutinum.Converter/Reader/TypeQueryNode.js +14 -37
- package/dist/Glutinum.Converter/Reader/TypeScriptReader.js +23 -5
- package/dist/Glutinum.Converter/Reader/Types.js +295 -15
- package/dist/Glutinum.Converter/Reader/UnionTypeNode.js +14 -28
- package/dist/Glutinum.Converter/Reader/UtilityType.js +811 -0
- package/dist/Glutinum.Converter/Reader/Utils.js +487 -101
- package/dist/Glutinum.Converter/Reader/VariableStatement.js +2 -3
- package/dist/Glutinum.Converter/Transform.js +2915 -8176
- package/dist/Glutinum.Converter/Transformer/AnyFunctionOverloads.js +116 -0
- package/dist/Glutinum.Converter/Transformer/CallableProperties.js +454 -0
- package/dist/Glutinum.Converter/Transformer/Comment.js +136 -0
- package/dist/Glutinum.Converter/Transformer/Conditionals.js +1087 -0
- package/dist/Glutinum.Converter/Transformer/Context.js +678 -0
- package/dist/Glutinum.Converter/Transformer/Enum.js +80 -0
- package/dist/Glutinum.Converter/Transformer/Exports.js +704 -0
- package/dist/Glutinum.Converter/Transformer/Heritage.js +493 -0
- package/dist/Glutinum.Converter/Transformer/KeyOfMaps.js +488 -0
- package/dist/Glutinum.Converter/Transformer/ParamObjectCandidate.js +460 -0
- package/dist/Glutinum.Converter/Transformer/TypeParameter.js +219 -0
- package/dist/Glutinum.Converter/Transformer/TypeParameters.js +448 -0
- package/dist/Glutinum.Converter/Transformer/UnionOverloads.js +356 -0
- package/dist/Glutinum.Converter/Transformer/Utils.js +341 -0
- package/dist/Glutinum.Converter/TypeScript.Extensions.js +0 -10
- package/dist/Glutinum.Converter/Utils/String.js +14 -3
- package/dist/Program.js +102 -239
- package/package.json +3 -2
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
|
|
2
|
+
import { empty, union, FSharpSet__Contains, ofList } from "../fable_modules/fable-library-js.5.17.2/Set.js";
|
|
3
|
+
import { isEmpty, map, choose } from "../fable_modules/fable-library-js.5.17.2/List.js";
|
|
4
|
+
import { comparePrimitives } from "../fable_modules/fable-library-js.5.17.2/Util.js";
|
|
5
|
+
import { FSharpModule, FSharpTypeAlias, FSharpDelegate, FSharpInterface, FSharpStaticMemberInfo, FSharpMember, FSharpMemberInfo, FSharpFunctionType, FSharpParameter, FSharpUnion, FSharpUnionCase, FSharpJSApi, FSharpThisType, FSharpTypeReference, FSharpMapped, FSharpTypeParameter, FSharpType } from "./FsharpAST.js";
|
|
6
|
+
import { substring } from "../fable_modules/fable-library-js.5.17.2/String.js";
|
|
7
|
+
|
|
8
|
+
function declaredNames(typeParameters) {
|
|
9
|
+
return ofList(choose((_arg) => {
|
|
10
|
+
if (_arg.tag === 0) {
|
|
11
|
+
return undefined;
|
|
12
|
+
}
|
|
13
|
+
else {
|
|
14
|
+
return _arg.fields[0].Name;
|
|
15
|
+
}
|
|
16
|
+
}, typeParameters), {
|
|
17
|
+
Compare: (x, y) => (comparePrimitives(x, y) | 0),
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function eraseType(bound, typ) {
|
|
22
|
+
let info_1;
|
|
23
|
+
const erase = (typ_1) => eraseType(bound, typ_1);
|
|
24
|
+
const eraseTypeParameters = (typeParameters) => map((_arg) => {
|
|
25
|
+
if (_arg.tag === 1) {
|
|
26
|
+
if (FSharpSet__Contains(bound, _arg.fields[0].Name)) {
|
|
27
|
+
return _arg;
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
return new FSharpTypeParameter(/* FSharpType */ 0, [FSharpType.Object$]);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
return new FSharpTypeParameter(/* FSharpType */ 0, [erase(_arg.fields[0])]);
|
|
35
|
+
}
|
|
36
|
+
}, typeParameters);
|
|
37
|
+
let matchResult, name_1, info_2, info_3, typeReference, thisType, typ_3, typ_4, typ_5, types, unionInfo, functionType, typ_10;
|
|
38
|
+
switch (typ.tag) {
|
|
39
|
+
case 13: {
|
|
40
|
+
if (!FSharpSet__Contains(bound, typ.fields[0])) {
|
|
41
|
+
matchResult = 0;
|
|
42
|
+
name_1 = typ.fields[0];
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
matchResult = 11;
|
|
46
|
+
typ_10 = typ;
|
|
47
|
+
}
|
|
48
|
+
break;
|
|
49
|
+
}
|
|
50
|
+
case 7: {
|
|
51
|
+
if ((info_1 = typ.fields[0], info_1.Name.startsWith("\'") && !FSharpSet__Contains(bound, substring(info_1.Name, 1)))) {
|
|
52
|
+
matchResult = 1;
|
|
53
|
+
info_2 = typ.fields[0];
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
matchResult = 2;
|
|
57
|
+
info_3 = typ.fields[0];
|
|
58
|
+
}
|
|
59
|
+
break;
|
|
60
|
+
}
|
|
61
|
+
case 11: {
|
|
62
|
+
matchResult = 3;
|
|
63
|
+
typeReference = typ.fields[0];
|
|
64
|
+
break;
|
|
65
|
+
}
|
|
66
|
+
case 15: {
|
|
67
|
+
matchResult = 4;
|
|
68
|
+
thisType = typ.fields[0];
|
|
69
|
+
break;
|
|
70
|
+
}
|
|
71
|
+
case 3: {
|
|
72
|
+
matchResult = 5;
|
|
73
|
+
typ_3 = typ.fields[0];
|
|
74
|
+
break;
|
|
75
|
+
}
|
|
76
|
+
case 14: {
|
|
77
|
+
matchResult = 6;
|
|
78
|
+
typ_4 = typ.fields[0];
|
|
79
|
+
break;
|
|
80
|
+
}
|
|
81
|
+
case 19: {
|
|
82
|
+
matchResult = 7;
|
|
83
|
+
typ_5 = typ.fields[0].fields[0];
|
|
84
|
+
break;
|
|
85
|
+
}
|
|
86
|
+
case 12: {
|
|
87
|
+
matchResult = 8;
|
|
88
|
+
types = typ.fields[0];
|
|
89
|
+
break;
|
|
90
|
+
}
|
|
91
|
+
case 1: {
|
|
92
|
+
matchResult = 9;
|
|
93
|
+
unionInfo = typ.fields[0];
|
|
94
|
+
break;
|
|
95
|
+
}
|
|
96
|
+
case 16: {
|
|
97
|
+
matchResult = 10;
|
|
98
|
+
functionType = typ.fields[0];
|
|
99
|
+
break;
|
|
100
|
+
}
|
|
101
|
+
default: {
|
|
102
|
+
matchResult = 11;
|
|
103
|
+
typ_10 = typ;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
switch (matchResult) {
|
|
107
|
+
case 0:
|
|
108
|
+
return FSharpType.Object$;
|
|
109
|
+
case 1:
|
|
110
|
+
return FSharpType.Object$;
|
|
111
|
+
case 2:
|
|
112
|
+
return new FSharpType(/* Mapped */ 7, [new FSharpMapped(info_3.Name, eraseTypeParameters(info_3.TypeParameters))]);
|
|
113
|
+
case 3:
|
|
114
|
+
return new FSharpType(/* TypeReference */ 11, [new FSharpTypeReference(typeReference.Name, typeReference.FullName, typeReference.ModulePath, map(erase, typeReference.TypeArguments), typeReference.Type)]);
|
|
115
|
+
case 4:
|
|
116
|
+
return new FSharpType(/* ThisType */ 15, [new FSharpThisType(thisType.Name, eraseTypeParameters(thisType.TypeParameters))]);
|
|
117
|
+
case 5:
|
|
118
|
+
return new FSharpType(/* Option */ 3, [erase(typ_3)]);
|
|
119
|
+
case 6:
|
|
120
|
+
return new FSharpType(/* ResizeArray */ 14, [erase(typ_4)]);
|
|
121
|
+
case 7:
|
|
122
|
+
return new FSharpType(/* JSApi */ 19, [new FSharpJSApi(erase(typ_5))]);
|
|
123
|
+
case 8:
|
|
124
|
+
return new FSharpType(/* Tuple */ 12, [map(erase, types)]);
|
|
125
|
+
case 9: {
|
|
126
|
+
const bound_1 = union(bound, declaredNames(unionInfo.TypeParameters));
|
|
127
|
+
const erase_1 = (typ_6) => eraseType(bound_1, typ_6);
|
|
128
|
+
return new FSharpType(/* Union */ 1, [new FSharpUnion(unionInfo.Attributes, unionInfo.Name, map((_arg_1) => {
|
|
129
|
+
switch (_arg_1.tag) {
|
|
130
|
+
case 1:
|
|
131
|
+
return new FSharpUnionCase(/* Typed */ 1, [erase_1(_arg_1.fields[0])]);
|
|
132
|
+
case 2:
|
|
133
|
+
return new FSharpUnionCase(/* Field */ 2, [_arg_1.fields[0], erase_1(_arg_1.fields[1])]);
|
|
134
|
+
case 3:
|
|
135
|
+
return new FSharpUnionCase(/* NamedFields */ 3, [_arg_1.fields[0], map((tupledArg) => [tupledArg[0], erase_1(tupledArg[1])], _arg_1.fields[1])]);
|
|
136
|
+
default:
|
|
137
|
+
return _arg_1;
|
|
138
|
+
}
|
|
139
|
+
}, unionInfo.Cases), unionInfo.IsOptional, unionInfo.TypeParameters, unionInfo.Constants)]);
|
|
140
|
+
}
|
|
141
|
+
case 10:
|
|
142
|
+
return new FSharpType(/* Function */ 16, [new FSharpFunctionType(map((parameter) => (new FSharpParameter(parameter.Attributes, parameter.Name, parameter.IsOptional, erase(parameter.Type), parameter.OriginalGlueMember)), functionType.Parameters), erase(functionType.ReturnType))]);
|
|
143
|
+
default:
|
|
144
|
+
return typ_10;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
function eraseParameters(bound, parameters) {
|
|
149
|
+
return map((parameter) => (new FSharpParameter(parameter.Attributes, parameter.Name, parameter.IsOptional, eraseType(bound, parameter.Type), parameter.OriginalGlueMember)), parameters);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
function eraseMember(bound, fsharpMember) {
|
|
153
|
+
const erase = (isProperty, typeParameters, parameters, typ) => {
|
|
154
|
+
if (isEmpty(typeParameters) && !isProperty) {
|
|
155
|
+
return [parameters, typ];
|
|
156
|
+
}
|
|
157
|
+
else {
|
|
158
|
+
const bound_1 = union(bound, declaredNames(typeParameters));
|
|
159
|
+
return [eraseParameters(bound_1, parameters), eraseType(bound_1, typ)];
|
|
160
|
+
}
|
|
161
|
+
};
|
|
162
|
+
switch (fsharpMember.tag) {
|
|
163
|
+
case 1: {
|
|
164
|
+
const info_1 = fsharpMember.fields[0];
|
|
165
|
+
const patternInput_1 = erase(true, info_1.TypeParameters, info_1.Parameters, info_1.Type);
|
|
166
|
+
return new FSharpMember(/* Property */ 1, [new FSharpMemberInfo(info_1.Attributes, info_1.Name, info_1.OriginalName, info_1.TypeParameters, patternInput_1[0], patternInput_1[1], info_1.IsOptional, info_1.IsStatic, info_1.Accessor, info_1.Accessibility, info_1.XmlDoc, info_1.Body)]);
|
|
167
|
+
}
|
|
168
|
+
case 2: {
|
|
169
|
+
const info_2 = fsharpMember.fields[0];
|
|
170
|
+
const patternInput_2 = erase(info_2.Accessor != null, info_2.TypeParameters, info_2.Parameters, info_2.Type);
|
|
171
|
+
return new FSharpMember(/* StaticMember */ 2, [new FSharpStaticMemberInfo(info_2.Attributes, info_2.Name, info_2.OriginalName, info_2.TypeParameters, patternInput_2[0], patternInput_2[1], info_2.IsOptional, info_2.Accessor, info_2.Accessibility, info_2.XmlDoc)]);
|
|
172
|
+
}
|
|
173
|
+
default: {
|
|
174
|
+
const info = fsharpMember.fields[0];
|
|
175
|
+
const patternInput = erase(info.Accessor != null, info.TypeParameters, info.Parameters, info.Type);
|
|
176
|
+
return new FSharpMember(/* Method */ 0, [new FSharpMemberInfo(info.Attributes, info.Name, info.OriginalName, info.TypeParameters, patternInput[0], patternInput[1], info.IsOptional, info.IsStatic, info.Accessor, info.Accessibility, info.XmlDoc, info.Body)]);
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
export function apply(types) {
|
|
182
|
+
return map((_arg) => {
|
|
183
|
+
switch (_arg.tag) {
|
|
184
|
+
case 5: {
|
|
185
|
+
const interfaceInfo = _arg.fields[0];
|
|
186
|
+
const bound = declaredNames(interfaceInfo.TypeParameters);
|
|
187
|
+
return new FSharpType(/* Interface */ 5, [new FSharpInterface(interfaceInfo.Attributes, interfaceInfo.Name, interfaceInfo.XmlDoc, interfaceInfo.OriginalName, interfaceInfo.TypeParameters, map((fsharpMember) => eraseMember(bound, fsharpMember), interfaceInfo.Members), interfaceInfo.Inheritance)]);
|
|
188
|
+
}
|
|
189
|
+
case 20: {
|
|
190
|
+
const delegateInfo = _arg.fields[0];
|
|
191
|
+
const bound_1 = declaredNames(delegateInfo.TypeParameters);
|
|
192
|
+
return new FSharpType(/* Delegate */ 20, [new FSharpDelegate(delegateInfo.XmlDoc, delegateInfo.Name, delegateInfo.TypeParameters, eraseParameters(bound_1, delegateInfo.Parameters), eraseType(bound_1, delegateInfo.ReturnType))]);
|
|
193
|
+
}
|
|
194
|
+
case 1:
|
|
195
|
+
return eraseType(empty({
|
|
196
|
+
Compare: (x, y) => (comparePrimitives(x, y) | 0),
|
|
197
|
+
}), _arg);
|
|
198
|
+
case 9: {
|
|
199
|
+
const aliasInfo = _arg.fields[0];
|
|
200
|
+
return new FSharpType(/* TypeAlias */ 9, [new FSharpTypeAlias(aliasInfo.Attributes, aliasInfo.Name, aliasInfo.XmlDoc, eraseType(declaredNames(aliasInfo.TypeParameters), aliasInfo.Type), aliasInfo.TypeParameters)]);
|
|
201
|
+
}
|
|
202
|
+
case 4: {
|
|
203
|
+
const moduleInfo = _arg.fields[0];
|
|
204
|
+
return new FSharpType(/* Module */ 4, [new FSharpModule(moduleInfo.Name, moduleInfo.IsRecursive, moduleInfo.ImportSpecifier, apply(moduleInfo.Types))]);
|
|
205
|
+
}
|
|
206
|
+
default:
|
|
207
|
+
return _arg;
|
|
208
|
+
}
|
|
209
|
+
}, types);
|
|
210
|
+
}
|
|
211
|
+
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
|
|
2
|
-
import {
|
|
2
|
+
import { Union, Record } from "../fable_modules/fable-library-js.5.17.2/Types.js";
|
|
3
3
|
import { enum_type, option_type, tuple_type, bool_type, float64_type, int32_type, union_type, list_type, record_type, string_type } from "../fable_modules/fable-library-js.5.17.2/Reflection.js";
|
|
4
4
|
import { GlueMember_$reflection } from "./GlueAST.js";
|
|
5
|
-
import {
|
|
6
|
-
import { empty, forAll } from "../fable_modules/fable-library-js.5.17.2/List.js";
|
|
5
|
+
import { empty, cons, choose, singleton, map, forAll } from "../fable_modules/fable-library-js.5.17.2/List.js";
|
|
7
6
|
|
|
8
7
|
export class FSharpCommentParam extends Record {
|
|
9
8
|
constructor(Name, Content) {
|
|
@@ -129,24 +128,6 @@ export function FSharpUnionCase_$reflection() {
|
|
|
129
128
|
return union_type("Glutinum.Converter.FSharpAST.FSharpUnionCase", [], FSharpUnionCase, () => [[["Item", FSharpUnionCaseNamed_$reflection()]], [["Item", FSharpType_$reflection()]], [["name", string_type], ["typ", FSharpType_$reflection()]], [["info", FSharpUnionCaseNamed_$reflection()], ["fields", list_type(tuple_type(string_type, FSharpType_$reflection()))]]]);
|
|
130
129
|
}
|
|
131
130
|
|
|
132
|
-
export class FSharpUnionType extends Union {
|
|
133
|
-
constructor(tag, fields) {
|
|
134
|
-
super();
|
|
135
|
-
this.tag = tag;
|
|
136
|
-
this.fields = fields;
|
|
137
|
-
}
|
|
138
|
-
cases() {
|
|
139
|
-
return ["String", "Numeric", "Unknown"];
|
|
140
|
-
}
|
|
141
|
-
static String$ = new FSharpUnionType(0, []);
|
|
142
|
-
static Numeric = new FSharpUnionType(1, []);
|
|
143
|
-
static Unknown = new FSharpUnionType(2, []);
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
export function FSharpUnionType_$reflection() {
|
|
147
|
-
return union_type("Glutinum.Converter.FSharpAST.FSharpUnionType", [], FSharpUnionType, () => [[], [], []]);
|
|
148
|
-
}
|
|
149
|
-
|
|
150
131
|
/**
|
|
151
132
|
* `static member inline A: Mixed = Mixed.String "a"`
|
|
152
133
|
*/
|
|
@@ -617,33 +598,6 @@ export function FSharpType_$reflection() {
|
|
|
617
598
|
return union_type("Glutinum.Converter.FSharpAST.FSharpType", [], FSharpType, () => [[["Item", FSharpEnum_$reflection()]], [["Item", FSharpUnion_$reflection()]], [["Item", FSharpSingleErasedCaseUnion_$reflection()]], [["Item", FSharpType_$reflection()]], [["Item", FSharpModule_$reflection()]], [["Item", FSharpInterface_$reflection()]], [["Item", enum_type("TypeScript.Ts.SyntaxKind", int32_type, [["Unknown", 0], ["EndOfFileToken", 1], ["SingleLineCommentTrivia", 2], ["MultiLineCommentTrivia", 3], ["NewLineTrivia", 4], ["WhitespaceTrivia", 5], ["ShebangTrivia", 6], ["ConflictMarkerTrivia", 7], ["NonTextFileMarkerTrivia", 8], ["NumericLiteral", 9], ["BigIntLiteral", 10], ["StringLiteral", 11], ["JsxText", 12], ["JsxTextAllWhiteSpaces", 13], ["RegularExpressionLiteral", 14], ["NoSubstitutionTemplateLiteral", 15], ["TemplateHead", 16], ["TemplateMiddle", 17], ["TemplateTail", 18], ["OpenBraceToken", 19], ["CloseBraceToken", 20], ["OpenParenToken", 21], ["CloseParenToken", 22], ["OpenBracketToken", 23], ["CloseBracketToken", 24], ["DotToken", 25], ["DotDotDotToken", 26], ["SemicolonToken", 27], ["CommaToken", 28], ["QuestionDotToken", 29], ["LessThanToken", 30], ["LessThanSlashToken", 31], ["GreaterThanToken", 32], ["LessThanEqualsToken", 33], ["GreaterThanEqualsToken", 34], ["EqualsEqualsToken", 35], ["ExclamationEqualsToken", 36], ["EqualsEqualsEqualsToken", 37], ["ExclamationEqualsEqualsToken", 38], ["EqualsGreaterThanToken", 39], ["PlusToken", 40], ["MinusToken", 41], ["AsteriskToken", 42], ["AsteriskAsteriskToken", 43], ["SlashToken", 44], ["PercentToken", 45], ["PlusPlusToken", 46], ["MinusMinusToken", 47], ["LessThanLessThanToken", 48], ["GreaterThanGreaterThanToken", 49], ["GreaterThanGreaterThanGreaterThanToken", 50], ["AmpersandToken", 51], ["BarToken", 52], ["CaretToken", 53], ["ExclamationToken", 54], ["TildeToken", 55], ["AmpersandAmpersandToken", 56], ["BarBarToken", 57], ["QuestionToken", 58], ["ColonToken", 59], ["AtToken", 60], ["QuestionQuestionToken", 61], ["BacktickToken", 62], ["HashToken", 63], ["EqualsToken", 64], ["PlusEqualsToken", 65], ["MinusEqualsToken", 66], ["AsteriskEqualsToken", 67], ["AsteriskAsteriskEqualsToken", 68], ["SlashEqualsToken", 69], ["PercentEqualsToken", 70], ["LessThanLessThanEqualsToken", 71], ["GreaterThanGreaterThanEqualsToken", 72], ["GreaterThanGreaterThanGreaterThanEqualsToken", 73], ["AmpersandEqualsToken", 74], ["BarEqualsToken", 75], ["BarBarEqualsToken", 76], ["AmpersandAmpersandEqualsToken", 77], ["QuestionQuestionEqualsToken", 78], ["CaretEqualsToken", 79], ["Identifier", 80], ["PrivateIdentifier", 81], ["BreakKeyword", 83], ["CaseKeyword", 84], ["CatchKeyword", 85], ["ClassKeyword", 86], ["ConstKeyword", 87], ["ContinueKeyword", 88], ["DebuggerKeyword", 89], ["DefaultKeyword", 90], ["DeleteKeyword", 91], ["DoKeyword", 92], ["ElseKeyword", 93], ["EnumKeyword", 94], ["ExportKeyword", 95], ["ExtendsKeyword", 96], ["FalseKeyword", 97], ["FinallyKeyword", 98], ["ForKeyword", 99], ["FunctionKeyword", 100], ["IfKeyword", 101], ["ImportKeyword", 102], ["InKeyword", 103], ["InstanceOfKeyword", 104], ["NewKeyword", 105], ["NullKeyword", 106], ["ReturnKeyword", 107], ["SuperKeyword", 108], ["SwitchKeyword", 109], ["ThisKeyword", 110], ["ThrowKeyword", 111], ["TrueKeyword", 112], ["TryKeyword", 113], ["TypeOfKeyword", 114], ["VarKeyword", 115], ["VoidKeyword", 116], ["WhileKeyword", 117], ["WithKeyword", 118], ["ImplementsKeyword", 119], ["InterfaceKeyword", 120], ["LetKeyword", 121], ["PackageKeyword", 122], ["PrivateKeyword", 123], ["ProtectedKeyword", 124], ["PublicKeyword", 125], ["StaticKeyword", 126], ["YieldKeyword", 127], ["AbstractKeyword", 128], ["AccessorKeyword", 129], ["AsKeyword", 130], ["AssertsKeyword", 131], ["AssertKeyword", 132], ["AnyKeyword", 133], ["AsyncKeyword", 134], ["AwaitKeyword", 135], ["BooleanKeyword", 136], ["ConstructorKeyword", 137], ["DeclareKeyword", 138], ["GetKeyword", 139], ["InferKeyword", 140], ["IntrinsicKeyword", 141], ["IsKeyword", 142], ["KeyOfKeyword", 143], ["ModuleKeyword", 144], ["NamespaceKeyword", 145], ["NeverKeyword", 146], ["OutKeyword", 147], ["ReadonlyKeyword", 148], ["RequireKeyword", 149], ["NumberKeyword", 150], ["ObjectKeyword", 151], ["SatisfiesKeyword", 152], ["SetKeyword", 153], ["StringKeyword", 154], ["SymbolKeyword", 155], ["TypeKeyword", 156], ["UndefinedKeyword", 157], ["UniqueKeyword", 158], ["UnknownKeyword", 159], ["UsingKeyword", 160], ["FromKeyword", 161], ["GlobalKeyword", 162], ["BigIntKeyword", 163], ["OverrideKeyword", 164], ["OfKeyword", 165], ["DeferKeyword", 166], ["QualifiedName", 167], ["ComputedPropertyName", 168], ["TypeParameter", 169], ["Parameter", 170], ["Decorator", 171], ["PropertySignature", 172], ["PropertyDeclaration", 173], ["MethodSignature", 174], ["MethodDeclaration", 175], ["ClassStaticBlockDeclaration", 176], ["Constructor", 177], ["GetAccessor", 178], ["SetAccessor", 179], ["CallSignature", 180], ["ConstructSignature", 181], ["IndexSignature", 182], ["TypePredicate", 183], ["TypeReference", 184], ["FunctionType", 185], ["ConstructorType", 186], ["TypeQuery", 187], ["TypeLiteral", 188], ["ArrayType", 189], ["TupleType", 190], ["OptionalType", 191], ["RestType", 192], ["UnionType", 193], ["IntersectionType", 194], ["ConditionalType", 195], ["InferType", 196], ["ParenthesizedType", 197], ["ThisType", 198], ["TypeOperator", 199], ["IndexedAccessType", 200], ["MappedType", 201], ["LiteralType", 202], ["NamedTupleMember", 203], ["TemplateLiteralType", 204], ["TemplateLiteralTypeSpan", 205], ["ImportType", 206], ["ObjectBindingPattern", 207], ["ArrayBindingPattern", 208], ["BindingElement", 209], ["ArrayLiteralExpression", 210], ["ObjectLiteralExpression", 211], ["PropertyAccessExpression", 212], ["ElementAccessExpression", 213], ["CallExpression", 214], ["NewExpression", 215], ["TaggedTemplateExpression", 216], ["TypeAssertionExpression", 217], ["ParenthesizedExpression", 218], ["FunctionExpression", 219], ["ArrowFunction", 220], ["DeleteExpression", 221], ["TypeOfExpression", 222], ["VoidExpression", 223], ["AwaitExpression", 224], ["PrefixUnaryExpression", 225], ["PostfixUnaryExpression", 226], ["BinaryExpression", 227], ["ConditionalExpression", 228], ["TemplateExpression", 229], ["YieldExpression", 230], ["SpreadElement", 231], ["ClassExpression", 232], ["OmittedExpression", 233], ["ExpressionWithTypeArguments", 234], ["AsExpression", 235], ["NonNullExpression", 236], ["MetaProperty", 237], ["SyntheticExpression", 238], ["SatisfiesExpression", 239], ["TemplateSpan", 240], ["SemicolonClassElement", 241], ["Block", 242], ["EmptyStatement", 243], ["VariableStatement", 244], ["ExpressionStatement", 245], ["IfStatement", 246], ["DoStatement", 247], ["WhileStatement", 248], ["ForStatement", 249], ["ForInStatement", 250], ["ForOfStatement", 251], ["ContinueStatement", 252], ["BreakStatement", 253], ["ReturnStatement", 254], ["WithStatement", 255], ["SwitchStatement", 256], ["LabeledStatement", 257], ["ThrowStatement", 258], ["TryStatement", 259], ["DebuggerStatement", 260], ["VariableDeclaration", 261], ["VariableDeclarationList", 262], ["FunctionDeclaration", 263], ["ClassDeclaration", 264], ["InterfaceDeclaration", 265], ["TypeAliasDeclaration", 266], ["EnumDeclaration", 267], ["ModuleDeclaration", 268], ["ModuleBlock", 269], ["CaseBlock", 270], ["NamespaceExportDeclaration", 271], ["ImportEqualsDeclaration", 272], ["ImportDeclaration", 273], ["ImportClause", 274], ["NamespaceImport", 275], ["NamedImports", 276], ["ImportSpecifier", 277], ["ExportAssignment", 278], ["ExportDeclaration", 279], ["NamedExports", 280], ["NamespaceExport", 281], ["ExportSpecifier", 282], ["MissingDeclaration", 283], ["ExternalModuleReference", 284], ["JsxElement", 285], ["JsxSelfClosingElement", 286], ["JsxOpeningElement", 287], ["JsxClosingElement", 288], ["JsxFragment", 289], ["JsxOpeningFragment", 290], ["JsxClosingFragment", 291], ["JsxAttribute", 292], ["JsxAttributes", 293], ["JsxSpreadAttribute", 294], ["JsxExpression", 295], ["JsxNamespacedName", 296], ["CaseClause", 297], ["DefaultClause", 298], ["HeritageClause", 299], ["CatchClause", 300], ["ImportAttributes", 301], ["ImportAttribute", 302], ["AssertClause", 301], ["AssertEntry", 302], ["ImportTypeAssertionContainer", 303], ["PropertyAssignment", 304], ["ShorthandPropertyAssignment", 305], ["SpreadAssignment", 306], ["EnumMember", 307], ["SourceFile", 308], ["Bundle", 309], ["JSDocTypeExpression", 310], ["JSDocNameReference", 311], ["JSDocMemberName", 312], ["JSDocAllType", 313], ["JSDocUnknownType", 314], ["JSDocNullableType", 315], ["JSDocNonNullableType", 316], ["JSDocOptionalType", 317], ["JSDocFunctionType", 318], ["JSDocVariadicType", 319], ["JSDocNamepathType", 320], ["JSDoc", 321], ["JSDocComment", 321], ["JSDocText", 322], ["JSDocTypeLiteral", 323], ["JSDocSignature", 324], ["JSDocLink", 325], ["JSDocLinkCode", 326], ["JSDocLinkPlain", 327], ["JSDocTag", 328], ["JSDocAugmentsTag", 329], ["JSDocImplementsTag", 330], ["JSDocAuthorTag", 331], ["JSDocDeprecatedTag", 332], ["JSDocClassTag", 333], ["JSDocPublicTag", 334], ["JSDocPrivateTag", 335], ["JSDocProtectedTag", 336], ["JSDocReadonlyTag", 337], ["JSDocOverrideTag", 338], ["JSDocCallbackTag", 339], ["JSDocOverloadTag", 340], ["JSDocEnumTag", 341], ["JSDocParameterTag", 342], ["JSDocReturnTag", 343], ["JSDocThisTag", 344], ["JSDocTypeTag", 345], ["JSDocTemplateTag", 346], ["JSDocTypedefTag", 347], ["JSDocSeeTag", 348], ["JSDocPropertyTag", 349], ["JSDocThrowsTag", 350], ["JSDocSatisfiesTag", 351], ["JSDocImportTag", 352], ["SyntaxList", 353], ["NotEmittedStatement", 354], ["NotEmittedTypeElement", 355], ["PartiallyEmittedExpression", 356], ["CommaListExpression", 357], ["SyntheticReferenceExpression", 358], ["Count", 359], ["FirstAssignment", 64], ["LastAssignment", 79], ["FirstCompoundAssignment", 65], ["LastCompoundAssignment", 79], ["FirstReservedWord", 83], ["LastReservedWord", 118], ["FirstKeyword", 83], ["LastKeyword", 166], ["FirstFutureReservedWord", 119], ["LastFutureReservedWord", 127], ["FirstTypeNode", 183], ["LastTypeNode", 206], ["FirstPunctuation", 19], ["LastPunctuation", 79], ["FirstToken", 0], ["LastToken", 166], ["FirstTriviaToken", 2], ["LastTriviaToken", 7], ["FirstLiteralToken", 9], ["LastLiteralToken", 15], ["FirstTemplateToken", 15], ["LastTemplateToken", 18], ["FirstBinaryOperator", 30], ["LastBinaryOperator", 79], ["FirstStatement", 244], ["LastStatement", 260], ["FirstNode", 167], ["FirstJSDocNode", 310], ["LastJSDocNode", 352], ["FirstJSDocTagNode", 328], ["LastJSDocTagNode", 352]])]], [["Item", FSharpMapped_$reflection()]], [["Item", FSharpPrimitive_$reflection()]], [["Item", FSharpTypeAlias_$reflection()]], [], [["Item", FSharpTypeReference_$reflection()]], [["Item", list_type(FSharpType_$reflection())]], [["Item", string_type]], [["Item", FSharpType_$reflection()]], [["Item", FSharpThisType_$reflection()]], [["Item", FSharpFunctionType_$reflection()]], [["Item", FSharpClass_$reflection()]], [], [["Item", FSharpJSApi_$reflection()]], [["Item", FSharpDelegate_$reflection()]], [["Item", FSharpTypeExtension_$reflection()]]]);
|
|
618
599
|
}
|
|
619
600
|
|
|
620
|
-
export class FSharpOutFile extends Record {
|
|
621
|
-
constructor(Name, Opens) {
|
|
622
|
-
super();
|
|
623
|
-
this.Name = Name;
|
|
624
|
-
this.Opens = Opens;
|
|
625
|
-
}
|
|
626
|
-
}
|
|
627
|
-
|
|
628
|
-
export function FSharpOutFile_$reflection() {
|
|
629
|
-
return record_type("Glutinum.Converter.FSharpAST.FSharpOutFile", [], FSharpOutFile, () => [["Name", string_type], ["Opens", list_type(string_type)]]);
|
|
630
|
-
}
|
|
631
|
-
|
|
632
|
-
export function FSharpLiteral__ToText(this$) {
|
|
633
|
-
switch (this$.tag) {
|
|
634
|
-
case 1:
|
|
635
|
-
return int32ToString(this$.fields[0]);
|
|
636
|
-
case 2:
|
|
637
|
-
return this$.fields[0].toString();
|
|
638
|
-
case 3:
|
|
639
|
-
return toString(this$.fields[0]);
|
|
640
|
-
case 4:
|
|
641
|
-
return "null";
|
|
642
|
-
default:
|
|
643
|
-
return this$.fields[0];
|
|
644
|
-
}
|
|
645
|
-
}
|
|
646
|
-
|
|
647
601
|
export function FSharpEnum__get_Type(this$) {
|
|
648
602
|
const isString = forAll((c) => {
|
|
649
603
|
const matchValue = c.Value;
|
|
@@ -678,26 +632,123 @@ export function FSharpEnum__get_Type(this$) {
|
|
|
678
632
|
}
|
|
679
633
|
}
|
|
680
634
|
|
|
681
|
-
export function
|
|
682
|
-
|
|
683
|
-
case 1:
|
|
684
|
-
return "private";
|
|
685
|
-
case 2:
|
|
686
|
-
return "protected";
|
|
687
|
-
default:
|
|
688
|
-
return "public";
|
|
689
|
-
}
|
|
690
|
-
}
|
|
691
|
-
|
|
692
|
-
export function FSharpConstructor_get_EmptyPublic() {
|
|
693
|
-
return new FSharpConstructor(empty(), empty(), FSharpAccessibility.Public);
|
|
635
|
+
export function FSharpTypeParameterInfo_Create_Z6CFD3565(name, constraint_, default_) {
|
|
636
|
+
return new FSharpTypeParameterInfo(name, constraint_, default_);
|
|
694
637
|
}
|
|
695
638
|
|
|
696
|
-
export function
|
|
697
|
-
|
|
639
|
+
export function FSharpTypeModule_mapChildren(f, typ) {
|
|
640
|
+
switch (typ.tag) {
|
|
641
|
+
case 11: {
|
|
642
|
+
const typeReference = typ.fields[0];
|
|
643
|
+
return new FSharpType(/* TypeReference */ 11, [new FSharpTypeReference(typeReference.Name, typeReference.FullName, typeReference.ModulePath, map(f, typeReference.TypeArguments), typeReference.Type)]);
|
|
644
|
+
}
|
|
645
|
+
case 3:
|
|
646
|
+
return new FSharpType(/* Option */ 3, [f(typ.fields[0])]);
|
|
647
|
+
case 14:
|
|
648
|
+
return new FSharpType(/* ResizeArray */ 14, [f(typ.fields[0])]);
|
|
649
|
+
case 19:
|
|
650
|
+
return new FSharpType(/* JSApi */ 19, [new FSharpJSApi(f(typ.fields[0].fields[0]))]);
|
|
651
|
+
case 12:
|
|
652
|
+
return new FSharpType(/* Tuple */ 12, [map(f, typ.fields[0])]);
|
|
653
|
+
case 1: {
|
|
654
|
+
const unionInfo = typ.fields[0];
|
|
655
|
+
return new FSharpType(/* Union */ 1, [new FSharpUnion(unionInfo.Attributes, unionInfo.Name, map((_arg) => {
|
|
656
|
+
switch (_arg.tag) {
|
|
657
|
+
case 1:
|
|
658
|
+
return new FSharpUnionCase(/* Typed */ 1, [f(_arg.fields[0])]);
|
|
659
|
+
case 2:
|
|
660
|
+
return new FSharpUnionCase(/* Field */ 2, [_arg.fields[0], f(_arg.fields[1])]);
|
|
661
|
+
default:
|
|
662
|
+
return _arg;
|
|
663
|
+
}
|
|
664
|
+
}, unionInfo.Cases), unionInfo.IsOptional, unionInfo.TypeParameters, unionInfo.Constants)]);
|
|
665
|
+
}
|
|
666
|
+
case 16: {
|
|
667
|
+
const functionType = typ.fields[0];
|
|
668
|
+
return new FSharpType(/* Function */ 16, [new FSharpFunctionType(map((parameter) => (new FSharpParameter(parameter.Attributes, parameter.Name, parameter.IsOptional, f(parameter.Type), parameter.OriginalGlueMember)), functionType.Parameters), f(functionType.ReturnType))]);
|
|
669
|
+
}
|
|
670
|
+
default:
|
|
671
|
+
return typ;
|
|
672
|
+
}
|
|
698
673
|
}
|
|
699
674
|
|
|
700
|
-
|
|
701
|
-
|
|
675
|
+
/**
|
|
676
|
+
* The return type of a function comes before its parameters
|
|
677
|
+
*/
|
|
678
|
+
export function FSharpTypeModule_children(typ) {
|
|
679
|
+
let matchResult, inner;
|
|
680
|
+
switch (typ.tag) {
|
|
681
|
+
case 11: {
|
|
682
|
+
matchResult = 0;
|
|
683
|
+
break;
|
|
684
|
+
}
|
|
685
|
+
case 3: {
|
|
686
|
+
matchResult = 1;
|
|
687
|
+
inner = typ.fields[0];
|
|
688
|
+
break;
|
|
689
|
+
}
|
|
690
|
+
case 14: {
|
|
691
|
+
matchResult = 1;
|
|
692
|
+
inner = typ.fields[0];
|
|
693
|
+
break;
|
|
694
|
+
}
|
|
695
|
+
case 19: {
|
|
696
|
+
matchResult = 1;
|
|
697
|
+
inner = typ.fields[0].fields[0];
|
|
698
|
+
break;
|
|
699
|
+
}
|
|
700
|
+
case 12: {
|
|
701
|
+
matchResult = 2;
|
|
702
|
+
break;
|
|
703
|
+
}
|
|
704
|
+
case 1: {
|
|
705
|
+
matchResult = 3;
|
|
706
|
+
break;
|
|
707
|
+
}
|
|
708
|
+
case 16: {
|
|
709
|
+
matchResult = 4;
|
|
710
|
+
break;
|
|
711
|
+
}
|
|
712
|
+
default:
|
|
713
|
+
matchResult = 5;
|
|
714
|
+
}
|
|
715
|
+
switch (matchResult) {
|
|
716
|
+
case 0:
|
|
717
|
+
return typ.fields[0].TypeArguments;
|
|
718
|
+
case 1:
|
|
719
|
+
return singleton(inner);
|
|
720
|
+
case 2:
|
|
721
|
+
return typ.fields[0];
|
|
722
|
+
case 3:
|
|
723
|
+
return choose((_arg) => {
|
|
724
|
+
let matchResult_1, inner_1;
|
|
725
|
+
switch (_arg.tag) {
|
|
726
|
+
case 1: {
|
|
727
|
+
matchResult_1 = 0;
|
|
728
|
+
inner_1 = _arg.fields[0];
|
|
729
|
+
break;
|
|
730
|
+
}
|
|
731
|
+
case 2: {
|
|
732
|
+
matchResult_1 = 0;
|
|
733
|
+
inner_1 = _arg.fields[1];
|
|
734
|
+
break;
|
|
735
|
+
}
|
|
736
|
+
default:
|
|
737
|
+
matchResult_1 = 1;
|
|
738
|
+
}
|
|
739
|
+
switch (matchResult_1) {
|
|
740
|
+
case 0:
|
|
741
|
+
return inner_1;
|
|
742
|
+
default:
|
|
743
|
+
return undefined;
|
|
744
|
+
}
|
|
745
|
+
}, typ.fields[0].Cases);
|
|
746
|
+
case 4: {
|
|
747
|
+
const functionType = typ.fields[0];
|
|
748
|
+
return cons(functionType.ReturnType, map((_arg_1) => _arg_1.Type, functionType.Parameters));
|
|
749
|
+
}
|
|
750
|
+
default:
|
|
751
|
+
return empty();
|
|
752
|
+
}
|
|
702
753
|
}
|
|
703
754
|
|
|
@@ -1,33 +1,29 @@
|
|
|
1
1
|
|
|
2
2
|
import { createNodeHost, Bootstrap_createProgramForCLI } from "./Hosting.js";
|
|
3
|
-
import
|
|
4
|
-
import { disposeSafe, getEnumerator, Exception } from "../fable_modules/fable-library-js.5.17.2/Util.js";
|
|
3
|
+
import { readFileSync, existsSync } from "fs";
|
|
4
|
+
import { comparePrimitives, disposeSafe, getEnumerator, Exception } from "../fable_modules/fable-library-js.5.17.2/Util.js";
|
|
5
5
|
import { concat } from "../fable_modules/fable-library-js.5.17.2/String.js";
|
|
6
|
-
import { toString } from "../fable_modules/fable-library-js.5.17.2/Types.js";
|
|
7
6
|
import { printFileWith, Printer_$ctor } from "./Printer.js";
|
|
8
7
|
import { readSourceFile } from "./Read.js";
|
|
9
8
|
import { error as error_1, warn } from "./Log.js";
|
|
10
|
-
import {
|
|
9
|
+
import { TransformOptions, applyWithOptions } from "./Transform.js";
|
|
10
|
+
import { ImportSource } from "./Transformer/Context.js";
|
|
11
11
|
import { defaultArg } from "../fable_modules/fable-library-js.5.17.2/Option.js";
|
|
12
|
-
import { empty } from "../fable_modules/fable-library-js.5.17.2/
|
|
13
|
-
import {
|
|
12
|
+
import { empty } from "../fable_modules/fable-library-js.5.17.2/Map.js";
|
|
13
|
+
import { empty as empty_1 } from "../fable_modules/fable-library-js.5.17.2/List.js";
|
|
14
|
+
import { toString } from "../fable_modules/fable-library-js.5.17.2/Types.js";
|
|
15
|
+
import { defaultMaxOverloads } from "./Transformer/UnionOverloads.js";
|
|
16
|
+
import { defaultOptions, generateWith } from "./Packages.js";
|
|
14
17
|
|
|
15
18
|
export function createProgramForCLI(fileName, source) {
|
|
16
19
|
return Bootstrap_createProgramForCLI(fileName, source);
|
|
17
20
|
}
|
|
18
21
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Generate the binding of a single declaration file as the module <c>moduleName</c>
|
|
25
|
-
*/
|
|
26
|
-
export function generateBindingFileWith(moduleName, filePath) {
|
|
27
|
-
if (!fs.existsSync(filePath)) {
|
|
22
|
+
function generateFile(moduleName, isGlobal, maxOverloads, filePath) {
|
|
23
|
+
if (!existsSync(filePath)) {
|
|
28
24
|
throw new Exception(concat("File does not exist: ", filePath));
|
|
29
25
|
}
|
|
30
|
-
const program = createProgramForCLI(filePath,
|
|
26
|
+
const program = createProgramForCLI(filePath, readFileSync(filePath, "utf8"));
|
|
31
27
|
const checker = program.getTypeChecker();
|
|
32
28
|
const sourceFile = program.getSourceFile(filePath);
|
|
33
29
|
const printer = Printer_$ctor();
|
|
@@ -41,7 +37,9 @@ export function generateBindingFileWith(moduleName, filePath) {
|
|
|
41
37
|
finally {
|
|
42
38
|
disposeSafe(enumerator);
|
|
43
39
|
}
|
|
44
|
-
const transformResult =
|
|
40
|
+
const transformResult = applyWithOptions(new TransformOptions(isGlobal ? ImportSource.Global : (new ImportSource(/* Module */ 0, [defaultArg(readerResult.ImportSpecifier, "REPLACE_ME_WITH_MODULE_NAME"), empty({
|
|
41
|
+
Compare: (x, y) => (comparePrimitives(x, y) | 0),
|
|
42
|
+
})])), maxOverloads), readerResult.TypeMemory, readerResult.GlueAST);
|
|
45
43
|
let enumerator_1 = getEnumerator(transformResult.Warnings);
|
|
46
44
|
try {
|
|
47
45
|
while (enumerator_1["System.Collections.IEnumerator.MoveNext"]()) {
|
|
@@ -60,16 +58,23 @@ export function generateBindingFileWith(moduleName, filePath) {
|
|
|
60
58
|
finally {
|
|
61
59
|
disposeSafe(enumerator_2);
|
|
62
60
|
}
|
|
63
|
-
printFileWith(moduleName, false,
|
|
61
|
+
printFileWith(moduleName, false, empty_1(), printer, transformResult);
|
|
64
62
|
return toString(printer);
|
|
65
63
|
}
|
|
66
64
|
|
|
65
|
+
export function generateBindingFileWith(moduleName, filePath) {
|
|
66
|
+
return generateFile(moduleName, false, defaultMaxOverloads, filePath);
|
|
67
|
+
}
|
|
68
|
+
|
|
67
69
|
/**
|
|
68
|
-
*
|
|
69
|
-
* An empty list generates every package installed in the nearest <c>node_modules</c>.
|
|
70
|
+
* `isGlobal`: the file declares the globals of a script, nothing is imported
|
|
70
71
|
*/
|
|
71
|
-
export function
|
|
72
|
-
return
|
|
72
|
+
export function generateBindingFileWithOptions(moduleName, isGlobal, maxOverloads, filePath) {
|
|
73
|
+
return generateFile(moduleName, isGlobal, maxOverloads, filePath);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export function generateBindingFile(filePath) {
|
|
77
|
+
return generateBindingFileWith("Glutinum", filePath);
|
|
73
78
|
}
|
|
74
79
|
|
|
75
80
|
export function generatePackagesWithOptions(options, host, inputs) {
|
|
@@ -96,13 +101,21 @@ export function generatePackagesWithOptions(options, host, inputs) {
|
|
|
96
101
|
}
|
|
97
102
|
|
|
98
103
|
/**
|
|
99
|
-
*
|
|
104
|
+
* Generate a single binding file for the packages, and the packages they depend on.
|
|
105
|
+
* An empty list generates every package installed in the nearest <c>node_modules</c>.
|
|
100
106
|
*/
|
|
101
|
-
export function
|
|
102
|
-
return
|
|
107
|
+
export function generatePackagesWith(host, inputs) {
|
|
108
|
+
return generatePackagesWithOptions(defaultOptions, host, inputs);
|
|
103
109
|
}
|
|
104
110
|
|
|
105
111
|
export function generatePackagesFromDisk(options, inputs) {
|
|
106
112
|
return generatePackagesWithOptions(options, createNodeHost(process.cwd()), inputs);
|
|
107
113
|
}
|
|
108
114
|
|
|
115
|
+
/**
|
|
116
|
+
* The packages installed on the disk, from the current directory
|
|
117
|
+
*/
|
|
118
|
+
export function generatePackages(inputs) {
|
|
119
|
+
return generatePackagesFromDisk(defaultOptions, inputs);
|
|
120
|
+
}
|
|
121
|
+
|