@glutinum/cli 0.14.0 → 1.0.0-beta.1
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/FsharpAST.js +38 -4
- package/dist/Glutinum.Converter/Generate.js +15 -7
- package/dist/Glutinum.Converter/GlueAST.js +45 -36
- package/dist/Glutinum.Converter/Hosting.js +918 -0
- package/dist/Glutinum.Converter/Merge.js +218 -82
- package/dist/Glutinum.Converter/Packages.js +44 -8
- package/dist/Glutinum.Converter/Printer.js +77 -49
- package/dist/Glutinum.Converter/Read.js +8 -8
- package/dist/Glutinum.Converter/Reader/ClassDeclaration.js +7 -7
- package/dist/Glutinum.Converter/Reader/Declaration.js +26 -26
- package/dist/Glutinum.Converter/Reader/Documentation.js +37 -36
- package/dist/Glutinum.Converter/Reader/ExportAssignment.js +5 -5
- package/dist/Glutinum.Converter/Reader/ExportDeclaration.js +31 -19
- package/dist/Glutinum.Converter/Reader/FunctionDeclaration.js +6 -7
- package/dist/Glutinum.Converter/Reader/IndexedAccessType.js +36 -29
- package/dist/Glutinum.Converter/Reader/InterfaceDeclaration.js +3 -3
- package/dist/Glutinum.Converter/Reader/MappedTypeNode.js +82 -4
- package/dist/Glutinum.Converter/Reader/ModuleDeclaration.js +3 -3
- package/dist/Glutinum.Converter/Reader/Node.js +20 -20
- package/dist/Glutinum.Converter/Reader/Parameters.js +7 -7
- package/dist/Glutinum.Converter/Reader/TypeAliasDeclaration.js +5 -5
- package/dist/Glutinum.Converter/Reader/TypeNode.js +291 -232
- package/dist/Glutinum.Converter/Reader/TypeOperatorNode.js +8 -8
- package/dist/Glutinum.Converter/Reader/TypeQueryNode.js +108 -40
- package/dist/Glutinum.Converter/Reader/TypeScriptReader.js +2 -2
- package/dist/Glutinum.Converter/Reader/Types.js +6 -6
- package/dist/Glutinum.Converter/Reader/UnionTypeNode.js +7 -6
- package/dist/Glutinum.Converter/Reader/Utils.js +106 -56
- package/dist/Glutinum.Converter/Transform.js +2057 -700
- package/dist/Glutinum.Converter/TypeScript.Extensions.js +194 -202
- package/dist/Glutinum.Converter/Utils/Naming.js +7 -0
- package/dist/Glutinum.Converter/Utils/String.js +2 -2
- package/dist/Program.js +38 -26
- package/dist/fable_modules/Fable.Promise.3.2.1/AsyncIterable.fs +89 -0
- package/dist/fable_modules/Fable.Promise.3.2.1/AsyncIterable.fs.js +105 -0
- package/dist/fable_modules/Fable.Promise.3.2.1/Fable.Promise.fableproj +25 -0
- package/dist/fable_modules/Fable.Promise.3.2.1/Promise.fs +842 -0
- package/dist/fable_modules/Fable.Promise.3.2.1/Promise.fs.js +232 -0
- package/dist/fable_modules/Fable.Promise.3.2.1/PromiseImpl.fs +31 -0
- package/dist/fable_modules/Fable.Promise.3.2.1/PromiseImpl.fs.js +20 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/Array.fs +235 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/Array.fs.js +384 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/AssemblyInfo.fs +19 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/Async.fs +287 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/Async.fs.js +128 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/AsyncOption.fs +127 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/AsyncOptionCE.fs +174 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/AsyncOptionCE.fs.js +37 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/AsyncOptionOp.fs +24 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/AsyncResult.fs +483 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/AsyncResultCE.fs +201 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/AsyncResultCE.fs.js +18 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/AsyncResultOp.fs +24 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/AsyncResultOption.fs +87 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/AsyncResultOption.fs.js +26 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/AsyncResultOptionCE.fs +236 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/AsyncResultOptionCE.fs.js +18 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/AsyncResultOptionOp.fs +24 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/AsyncValidation.fs +185 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/AsyncValidationCE.fs +186 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/AsyncValidationCE.fs.js +18 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/AsyncValidationOp.fs +35 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/FsToolkit.ErrorHandling.fableproj +69 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/List.fs +276 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/List.fs.js +364 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/Nullness.fs +81 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/Option.fs +462 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/OptionCE.fs +139 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/OptionCE.fs.js +48 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/OptionOp.fs +21 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ParallelAsyncResult.fs +88 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ParallelAsyncResult.fs.js +30 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ParallelAsyncResultCE.fs +200 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ParallelAsyncResultCE.fs.js +18 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ParallelAsyncValidation.fs +34 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ParallelAsyncValidationCE.fs +244 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ParallelAsyncValidationCE.fs.js +18 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/Result.fs +731 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/Result.fs.js +45 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ResultCE.fs +140 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ResultCE.fs.js +23 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ResultOp.fs +45 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ResultOption.fs +201 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ResultOption.fs.js +65 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ResultOptionCE.fs +135 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ResultOptionCE.fs.js +18 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ResultOptionOp.fs +57 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/Seq.fs +503 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/Seq.fs.js +295 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/Validation.fs +167 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ValidationCE.fs +142 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ValidationCE.fs.js +18 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ValidationOp.fs +35 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ValueOption.fs +148 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ValueTaskValueOption.fs +102 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ValueTaskValueOptionCE.fs +587 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ValueTaskValueOptionOp.fs +10 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/obj/Debug/netstandard2.1/.NETStandard,Version=v2.1.AssemblyAttributes.fs +3 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/obj/Debug/netstandard2.1/FsToolkit.ErrorHandling.AssemblyInfo.fs +20 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/obj/Release/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.fs +3 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/obj/Release/net9.0/FsToolkit.ErrorHandling.AssemblyInfo.fs +20 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/obj/Release/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.fs +3 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/obj/Release/netstandard2.0/FsToolkit.ErrorHandling.AssemblyInfo.fs +20 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/obj/Release/netstandard2.1/.NETStandard,Version=v2.1.AssemblyAttributes.fs +3 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/obj/Release/netstandard2.1/FsToolkit.ErrorHandling.AssemblyInfo.fs +20 -0
- package/dist/fable_modules/fable-library-js.5.17.2/Array.js +1348 -0
- package/dist/fable_modules/fable-library-js.5.17.2/Async.js +163 -0
- package/dist/fable_modules/fable-library-js.5.17.2/AsyncBuilder.js +204 -0
- package/dist/fable_modules/fable-library-js.5.17.2/BigInt.js +307 -0
- package/dist/fable_modules/fable-library-js.5.17.2/BitConverter.js +138 -0
- package/dist/fable_modules/fable-library-js.5.17.2/Boolean.js +22 -0
- package/dist/fable_modules/fable-library-js.5.17.2/CHANGELOG.md +348 -0
- package/dist/fable_modules/fable-library-js.5.17.2/Char.js +202 -0
- package/dist/fable_modules/fable-library-js.5.17.2/Choice.js +184 -0
- package/dist/fable_modules/fable-library-js.5.17.2/CollectionUtil.js +182 -0
- package/dist/fable_modules/fable-library-js.5.17.2/ConditionalWeakTable.js +21 -0
- package/dist/fable_modules/fable-library-js.5.17.2/Date.js +834 -0
- package/dist/fable_modules/fable-library-js.5.17.2/DateOffset.js +252 -0
- package/dist/fable_modules/fable-library-js.5.17.2/DateOnly.js +124 -0
- package/dist/fable_modules/fable-library-js.5.17.2/DateOnlyTemporal.js +146 -0
- package/dist/fable_modules/fable-library-js.5.17.2/DateTimeFormat.js +523 -0
- package/dist/fable_modules/fable-library-js.5.17.2/DateTimeOffsetTemporal.js +283 -0
- package/dist/fable_modules/fable-library-js.5.17.2/DateTimeTemporal.js +243 -0
- package/dist/fable_modules/fable-library-js.5.17.2/Decimal.js +238 -0
- package/dist/fable_modules/fable-library-js.5.17.2/Directory.js +11 -0
- package/dist/fable_modules/fable-library-js.5.17.2/Double.js +53 -0
- package/dist/fable_modules/fable-library-js.5.17.2/Encoding.js +185 -0
- package/dist/fable_modules/fable-library-js.5.17.2/Environment.js +3 -0
- package/dist/fable_modules/fable-library-js.5.17.2/Event.js +102 -0
- package/dist/fable_modules/fable-library-js.5.17.2/FSharp.Collections.js +45 -0
- package/dist/fable_modules/fable-library-js.5.17.2/FSharp.Core.CompilerServices.js +27 -0
- package/dist/fable_modules/fable-library-js.5.17.2/FSharp.Core.js +156 -0
- package/dist/fable_modules/fable-library-js.5.17.2/File.js +27 -0
- package/dist/fable_modules/fable-library-js.5.17.2/Global.js +29 -0
- package/dist/fable_modules/fable-library-js.5.17.2/Guid.js +163 -0
- package/dist/fable_modules/fable-library-js.5.17.2/Int32.js +135 -0
- package/dist/fable_modules/fable-library-js.5.17.2/List.js +1337 -0
- package/dist/fable_modules/fable-library-js.5.17.2/Long.js +38 -0
- package/dist/fable_modules/fable-library-js.5.17.2/MailboxProcessor.js +100 -0
- package/dist/fable_modules/fable-library-js.5.17.2/Map.js +1400 -0
- package/dist/fable_modules/fable-library-js.5.17.2/MapUtil.js +130 -0
- package/dist/fable_modules/fable-library-js.5.17.2/MutableMap.js +339 -0
- package/dist/fable_modules/fable-library-js.5.17.2/MutableSet.js +233 -0
- package/dist/fable_modules/fable-library-js.5.17.2/Native.js +14 -0
- package/dist/fable_modules/fable-library-js.5.17.2/Numeric.js +112 -0
- package/dist/fable_modules/fable-library-js.5.17.2/Observable.js +115 -0
- package/dist/fable_modules/fable-library-js.5.17.2/Option.js +87 -0
- package/dist/fable_modules/fable-library-js.5.17.2/Path.js +31 -0
- package/dist/fable_modules/fable-library-js.5.17.2/README.md +3 -0
- package/dist/fable_modules/fable-library-js.5.17.2/Random.js +172 -0
- package/dist/fable_modules/fable-library-js.5.17.2/Range.js +45 -0
- package/dist/fable_modules/fable-library-js.5.17.2/Reflection.js +489 -0
- package/dist/fable_modules/fable-library-js.5.17.2/RegExp.js +170 -0
- package/dist/fable_modules/fable-library-js.5.17.2/Result.js +165 -0
- package/dist/fable_modules/fable-library-js.5.17.2/Seq.js +1504 -0
- package/dist/fable_modules/fable-library-js.5.17.2/Seq2.js +111 -0
- package/dist/fable_modules/fable-library-js.5.17.2/Set.js +1829 -0
- package/dist/fable_modules/fable-library-js.5.17.2/String.js +731 -0
- package/dist/fable_modules/fable-library-js.5.17.2/System.Collections.Generic.js +333 -0
- package/dist/fable_modules/fable-library-js.5.17.2/System.Text.js +200 -0
- package/dist/fable_modules/fable-library-js.5.17.2/System.js +289 -0
- package/dist/fable_modules/fable-library-js.5.17.2/Task.js +27 -0
- package/dist/fable_modules/fable-library-js.5.17.2/TaskBuilder.js +72 -0
- package/dist/fable_modules/fable-library-js.5.17.2/TimeOnly.js +122 -0
- package/dist/fable_modules/fable-library-js.5.17.2/TimeOnlyTemporal.js +142 -0
- package/dist/fable_modules/fable-library-js.5.17.2/TimeSpan.js +180 -0
- package/dist/fable_modules/fable-library-js.5.17.2/TimeSpanTemporal.js +259 -0
- package/dist/fable_modules/fable-library-js.5.17.2/Timer.js +67 -0
- package/dist/fable_modules/fable-library-js.5.17.2/Types.js +198 -0
- package/dist/fable_modules/fable-library-js.5.17.2/Unicode.13.0.0.js +4 -0
- package/dist/fable_modules/fable-library-js.5.17.2/Uri.js +165 -0
- package/dist/fable_modules/fable-library-js.5.17.2/Util.js +807 -0
- package/dist/fable_modules/fable-library-js.5.17.2/big.d.ts +338 -0
- package/dist/fable_modules/fable-library-js.5.17.2/lib/big.js +829 -0
- package/dist/fable_modules/fable-library-js.5.17.2/package.json +24 -0
- package/dist/fable_modules/fable-library-js.5.17.2/quotation.js +682 -0
- package/package.json +2 -2
- package/dist/Glutinum.Converter/TypeScript.js +0 -12
- package/src/Glutinum.Converter/js/bootstrap.js +0 -123
- package/src/Glutinum.Converter/js/host.js +0 -144
- package/src/Glutinum.Converter/js/npm.js +0 -137
- package/src/Glutinum.Converter/js/resolve.js +0 -402
package/dist/Program.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
|
|
2
2
|
import { success, info, error, log } from "./Glutinum.Converter/Log.js";
|
|
3
|
-
import {
|
|
4
|
-
import { length, exists, filter, contains, cons, singleton, append, reverse,
|
|
3
|
+
import { generateBindingFileWith, generatePackagesFromDisk } from "./Glutinum.Converter/Generate.js";
|
|
4
|
+
import { length, exists, filter, contains, cons, ofArray, singleton, append, reverse, tail as tail_5, head, isEmpty, empty } from "./fable_modules/fable-library-js.5.17.2/List.js";
|
|
5
|
+
import { defaultArg } from "./fable_modules/fable-library-js.5.17.2/Option.js";
|
|
6
|
+
import { join, concat, split } from "./fable_modules/fable-library-js.5.17.2/String.js";
|
|
5
7
|
import { item, equalsWith } from "./fable_modules/fable-library-js.5.17.2/Array.js";
|
|
6
8
|
import { stringHash, defaultOf } from "./fable_modules/fable-library-js.5.17.2/Util.js";
|
|
7
9
|
import { defaultOptions, GenerateOptions } from "./Glutinum.Converter/Packages.js";
|
|
8
|
-
import { join, concat } from "./fable_modules/fable-library-js.5.17.2/String.js";
|
|
9
10
|
import * as path from "path";
|
|
10
11
|
import * as fs from "fs";
|
|
11
12
|
|
|
@@ -56,17 +57,16 @@ function generate(options, inputs) {
|
|
|
56
57
|
case 0:
|
|
57
58
|
return generatePackagesFromDisk(options, empty());
|
|
58
59
|
case 1:
|
|
59
|
-
return
|
|
60
|
+
return generateBindingFileWith(defaultArg(options.ModuleName, "Glutinum"), input_1);
|
|
60
61
|
default:
|
|
61
62
|
return generatePackagesFromDisk(options, inputs_1);
|
|
62
63
|
}
|
|
63
64
|
}
|
|
64
65
|
|
|
65
|
-
|
|
66
|
-
const argv_1 = ofArray(argv);
|
|
66
|
+
function run(argv) {
|
|
67
67
|
let matchResult;
|
|
68
|
-
if (!isEmpty(
|
|
69
|
-
switch (head(
|
|
68
|
+
if (!isEmpty(argv)) {
|
|
69
|
+
switch (head(argv)) {
|
|
70
70
|
case "-h":
|
|
71
71
|
case "--help":
|
|
72
72
|
case "help": {
|
|
@@ -74,7 +74,7 @@ function generate(options, inputs) {
|
|
|
74
74
|
break;
|
|
75
75
|
}
|
|
76
76
|
case "--version": {
|
|
77
|
-
if (isEmpty(tail_5(
|
|
77
|
+
if (isEmpty(tail_5(argv))) {
|
|
78
78
|
matchResult = 1;
|
|
79
79
|
}
|
|
80
80
|
else {
|
|
@@ -100,7 +100,7 @@ function generate(options, inputs) {
|
|
|
100
100
|
}
|
|
101
101
|
default: {
|
|
102
102
|
let patternInput;
|
|
103
|
-
const matchValue = reverse(
|
|
103
|
+
const matchValue = reverse(argv);
|
|
104
104
|
let matchResult_1, inputs, outFile;
|
|
105
105
|
if (!isEmpty(matchValue)) {
|
|
106
106
|
if (!isEmpty(tail_5(matchValue))) {
|
|
@@ -126,7 +126,7 @@ function generate(options, inputs) {
|
|
|
126
126
|
break;
|
|
127
127
|
}
|
|
128
128
|
default:
|
|
129
|
-
patternInput = [
|
|
129
|
+
patternInput = [argv, undefined];
|
|
130
130
|
}
|
|
131
131
|
const outFile_1 = patternInput[1];
|
|
132
132
|
const takeOptions = (args_mut, options_mut, rest_mut) => {
|
|
@@ -194,7 +194,7 @@ function generate(options, inputs) {
|
|
|
194
194
|
switch (matchResult_2) {
|
|
195
195
|
case 0: {
|
|
196
196
|
args_mut = tail;
|
|
197
|
-
options_mut = (new GenerateOptions(options.ExternalPackages, append(options.Externals, singleton((matchValue_1 =
|
|
197
|
+
options_mut = (new GenerateOptions(options.ExternalPackages, append(options.Externals, singleton((matchValue_1 = split(value, ["="], undefined, 0), (!equalsWith((x, y) => (x === y), matchValue_1, defaultOf()) && (matchValue_1.length === 2)) ? [item(0, matchValue_1), item(1, matchValue_1)] : [value, undefined]))), options.ModuleName, options.Include, options.NoLib));
|
|
198
198
|
rest_mut = rest;
|
|
199
199
|
continue takeOptions;
|
|
200
200
|
}
|
|
@@ -212,7 +212,7 @@ function generate(options, inputs) {
|
|
|
212
212
|
}
|
|
213
213
|
case 3: {
|
|
214
214
|
args_mut = tail_3;
|
|
215
|
-
options_mut = (new GenerateOptions(options.ExternalPackages, options.Externals, options.ModuleName, append(options.Include, ofArray(
|
|
215
|
+
options_mut = (new GenerateOptions(options.ExternalPackages, options.Externals, options.ModuleName, append(options.Include, ofArray(split(value_2, [","], undefined, 0))), options.NoLib));
|
|
216
216
|
rest_mut = rest;
|
|
217
217
|
continue takeOptions;
|
|
218
218
|
}
|
|
@@ -256,23 +256,35 @@ function generate(options, inputs) {
|
|
|
256
256
|
}
|
|
257
257
|
else {
|
|
258
258
|
info(concat("Generating binding file for ", join(", ", inputs_3)));
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
259
|
+
try {
|
|
260
|
+
const res = generate(options_2, inputs_3);
|
|
261
|
+
if (outFile_1 == null) {
|
|
262
|
+
process.stdout.write(res);
|
|
263
|
+
}
|
|
264
|
+
else {
|
|
265
|
+
const outFile_2 = outFile_1;
|
|
266
|
+
const outFileDir = path.dirname(outFile_2);
|
|
267
|
+
fs.mkdirSync(outFileDir, {
|
|
268
|
+
recursive: true,
|
|
269
|
+
});
|
|
270
|
+
fs.writeFileSync(outFile_2, res);
|
|
271
|
+
info(concat("Bindings written to: ", path.join(process.cwd(), outFile_2)));
|
|
272
|
+
}
|
|
273
|
+
success("Success!");
|
|
274
|
+
return 0;
|
|
262
275
|
}
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
fs.mkdirSync(outFileDir, {
|
|
267
|
-
recursive: true,
|
|
268
|
-
});
|
|
269
|
-
fs.writeFileSync(outFile_2, res);
|
|
270
|
-
info(concat("Bindings written to: ", path.join(process.cwd(), outFile_2)));
|
|
276
|
+
catch (ex) {
|
|
277
|
+
error(ex.message);
|
|
278
|
+
return 1;
|
|
271
279
|
}
|
|
272
|
-
success("Success!");
|
|
273
|
-
return 0;
|
|
274
280
|
}
|
|
275
281
|
}
|
|
276
282
|
}
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
(function (argv) {
|
|
286
|
+
const exitCode = run(ofArray(argv)) | 0;
|
|
287
|
+
process.exitCode = exitCode;
|
|
288
|
+
return exitCode | 0;
|
|
277
289
|
})(typeof process === 'object' ? process.argv.slice(2) : []);
|
|
278
290
|
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
[<RequireQualifiedAccess>]
|
|
2
|
+
module AsyncIterable
|
|
3
|
+
|
|
4
|
+
open Fable.Core
|
|
5
|
+
open Fable.Core.JsInterop
|
|
6
|
+
|
|
7
|
+
[<Emit("""{
|
|
8
|
+
[Symbol.asyncIterator]() {
|
|
9
|
+
return {
|
|
10
|
+
next: $0,
|
|
11
|
+
return: $1
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}""")>]
|
|
15
|
+
let private createAsyncIterator
|
|
16
|
+
(onNext: unit -> JS.Promise<obj>)
|
|
17
|
+
(onCancel: unit -> obj)
|
|
18
|
+
: JS.AsyncIterable<'T>
|
|
19
|
+
=
|
|
20
|
+
jsNative
|
|
21
|
+
|
|
22
|
+
/// Creates AsyncIterable. See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for-await...of#specifications
|
|
23
|
+
let create (onNext: unit -> JS.Promise<'T option>) : JS.AsyncIterable<'T> =
|
|
24
|
+
createAsyncIterator
|
|
25
|
+
(fun () ->
|
|
26
|
+
onNext ()
|
|
27
|
+
|> Promise.map (
|
|
28
|
+
function
|
|
29
|
+
| Some value ->
|
|
30
|
+
createObj
|
|
31
|
+
[
|
|
32
|
+
"value" ==> value
|
|
33
|
+
"done" ==> false
|
|
34
|
+
]
|
|
35
|
+
| None -> createObj [ "done" ==> true ]
|
|
36
|
+
)
|
|
37
|
+
)
|
|
38
|
+
(fun () -> createObj [ "done" ==> true ])
|
|
39
|
+
|
|
40
|
+
/// Creates AsyncIterable with a cleaning function for cancellation (JS caller invokes `break` or `return` during iteration)
|
|
41
|
+
let createCancellable
|
|
42
|
+
(onCancel: unit -> unit)
|
|
43
|
+
(onNext: unit -> JS.Promise<'T option>)
|
|
44
|
+
: JS.AsyncIterable<'T>
|
|
45
|
+
=
|
|
46
|
+
createAsyncIterator
|
|
47
|
+
(fun () ->
|
|
48
|
+
onNext ()
|
|
49
|
+
|> Promise.map (
|
|
50
|
+
function
|
|
51
|
+
| Some value ->
|
|
52
|
+
createObj
|
|
53
|
+
[
|
|
54
|
+
"value" ==> value
|
|
55
|
+
"done" ==> false
|
|
56
|
+
]
|
|
57
|
+
| None -> createObj [ "done" ==> true ]
|
|
58
|
+
)
|
|
59
|
+
)
|
|
60
|
+
(fun () ->
|
|
61
|
+
onCancel ()
|
|
62
|
+
createObj [ "done" ==> true ]
|
|
63
|
+
)
|
|
64
|
+
|
|
65
|
+
type CancellationToken() =
|
|
66
|
+
member this.Cancel() : unit = raise !!this
|
|
67
|
+
|
|
68
|
+
/// Iterates AsyncIterable. See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for-await...of
|
|
69
|
+
let iter
|
|
70
|
+
(action: CancellationToken -> 'T -> unit)
|
|
71
|
+
(iterable: JS.AsyncIterable<'T>)
|
|
72
|
+
: JS.Promise<unit>
|
|
73
|
+
=
|
|
74
|
+
let token = CancellationToken()
|
|
75
|
+
|
|
76
|
+
emitJsExpr
|
|
77
|
+
(action, iterable, token)
|
|
78
|
+
"""(async () => {
|
|
79
|
+
for await (const value of $1) {
|
|
80
|
+
try {
|
|
81
|
+
$0($2, value)
|
|
82
|
+
} catch (err) {
|
|
83
|
+
if (err instanceof $2.constructor) {
|
|
84
|
+
break;
|
|
85
|
+
}
|
|
86
|
+
throw(err);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
})()"""
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
|
|
2
|
+
import { value as value_1 } from "../fable-library-js.5.17.2/Option.js";
|
|
3
|
+
import { class_type } from "../fable-library-js.5.17.2/Reflection.js";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Creates AsyncIterable. See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for-await...of#specifications
|
|
7
|
+
*/
|
|
8
|
+
export function create(onNext) {
|
|
9
|
+
return {
|
|
10
|
+
[Symbol.asyncIterator]() {
|
|
11
|
+
return {
|
|
12
|
+
next: (() => {
|
|
13
|
+
const pr = onNext();
|
|
14
|
+
return pr.then((_arg) => {
|
|
15
|
+
if (_arg == null) {
|
|
16
|
+
return {
|
|
17
|
+
done: true,
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
21
|
+
return {
|
|
22
|
+
value: value_1(_arg),
|
|
23
|
+
done: false,
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
}),
|
|
28
|
+
return: (() => ({
|
|
29
|
+
done: true,
|
|
30
|
+
}))
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Creates AsyncIterable with a cleaning function for cancellation (JS caller invokes `break` or `return` during iteration)
|
|
38
|
+
*/
|
|
39
|
+
export function createCancellable(onCancel, onNext) {
|
|
40
|
+
return {
|
|
41
|
+
[Symbol.asyncIterator]() {
|
|
42
|
+
return {
|
|
43
|
+
next: (() => {
|
|
44
|
+
const pr = onNext();
|
|
45
|
+
return pr.then((_arg) => {
|
|
46
|
+
if (_arg == null) {
|
|
47
|
+
return {
|
|
48
|
+
done: true,
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
return {
|
|
53
|
+
value: value_1(_arg),
|
|
54
|
+
done: false,
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
}),
|
|
59
|
+
return: (() => {
|
|
60
|
+
onCancel();
|
|
61
|
+
return {
|
|
62
|
+
done: true,
|
|
63
|
+
};
|
|
64
|
+
})
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export class CancellationToken {
|
|
71
|
+
constructor() {
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export function CancellationToken_$reflection() {
|
|
76
|
+
return class_type("AsyncIterable.CancellationToken", undefined, CancellationToken);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export function CancellationToken_$ctor() {
|
|
80
|
+
return new CancellationToken();
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export function CancellationToken__Cancel(this$) {
|
|
84
|
+
throw this$;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Iterates AsyncIterable. See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for-await...of
|
|
89
|
+
*/
|
|
90
|
+
export function iter(action, iterable) {
|
|
91
|
+
const token = CancellationToken_$ctor();
|
|
92
|
+
return (async () => {
|
|
93
|
+
for await (const value of iterable) {
|
|
94
|
+
try {
|
|
95
|
+
action(token, value)
|
|
96
|
+
} catch (err) {
|
|
97
|
+
if (err instanceof token.constructor) {
|
|
98
|
+
break;
|
|
99
|
+
}
|
|
100
|
+
throw(err);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
})();
|
|
104
|
+
}
|
|
105
|
+
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
+
<Project Sdk="Microsoft.NET.Sdk">
|
|
3
|
+
<PropertyGroup>
|
|
4
|
+
<TargetFramework>netstandard2.0</TargetFramework>
|
|
5
|
+
<FablePackageType>library</FablePackageType>
|
|
6
|
+
<ChangelogFile>$(MSBuildThisFileDirectory)../CHANGELOG.md</ChangelogFile>
|
|
7
|
+
</PropertyGroup>
|
|
8
|
+
<ItemGroup>
|
|
9
|
+
<Compile Include="Promise.fs" />
|
|
10
|
+
<Compile Include="PromiseImpl.fs" />
|
|
11
|
+
<Compile Include="AsyncIterable.fs" />
|
|
12
|
+
</ItemGroup>
|
|
13
|
+
<ItemGroup>
|
|
14
|
+
<PackageReference Include="Fable.Core" Version="5.2.0" />
|
|
15
|
+
<PackageReference Include="EasyBuild.PackageReleaseNotes.Tasks" Version="2.1.0">
|
|
16
|
+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
|
17
|
+
<PrivateAssets>all</PrivateAssets>
|
|
18
|
+
</PackageReference>
|
|
19
|
+
<PackageReference Include="Fable.Package.SDK" Version="1.4.0">
|
|
20
|
+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
|
21
|
+
<PrivateAssets>all</PrivateAssets>
|
|
22
|
+
</PackageReference>
|
|
23
|
+
<PackageReference Update="FSharp.Core" Version="4.7.2" />
|
|
24
|
+
</ItemGroup>
|
|
25
|
+
</Project>
|