@glutinum/cli 0.14.0 → 0.14.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/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 +1 -1
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import { disposeSafe, defaultOf, Exception, structuralHash, equals } from "./Util.js";
|
|
2
|
+
import { HashIdentity_Structural, ComparisonIdentity_Structural } from "./FSharp.Collections.js";
|
|
3
|
+
import { nonNullValue } from "./Option.js";
|
|
4
|
+
import { NullReferenceException_$ctor, ArgumentNullException_$ctor_Z721C83C5 } from "./System.js";
|
|
5
|
+
import { FSharpChoice$2_Choice2Of2, FSharpChoice$2_Choice1Of2 } from "./Choice.js";
|
|
6
|
+
import { StringBuilder__Append_Z721C83C5 } from "./System.Text.js";
|
|
7
|
+
export const LanguagePrimitives_GenericEqualityComparer = {
|
|
8
|
+
Equals(x, y) {
|
|
9
|
+
return equals(x, y);
|
|
10
|
+
},
|
|
11
|
+
GetHashCode(x_1) {
|
|
12
|
+
return structuralHash(x_1) | 0;
|
|
13
|
+
},
|
|
14
|
+
};
|
|
15
|
+
export const LanguagePrimitives_GenericEqualityERComparer = {
|
|
16
|
+
Equals(x, y) {
|
|
17
|
+
return equals(x, y);
|
|
18
|
+
},
|
|
19
|
+
GetHashCode(x_1) {
|
|
20
|
+
return structuralHash(x_1) | 0;
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
export function LanguagePrimitives_FastGenericComparer() {
|
|
24
|
+
return ComparisonIdentity_Structural();
|
|
25
|
+
}
|
|
26
|
+
export function LanguagePrimitives_FastGenericComparerFromTable() {
|
|
27
|
+
return ComparisonIdentity_Structural();
|
|
28
|
+
}
|
|
29
|
+
export function LanguagePrimitives_FastGenericEqualityComparer() {
|
|
30
|
+
return HashIdentity_Structural();
|
|
31
|
+
}
|
|
32
|
+
export function LanguagePrimitives_FastGenericEqualityComparerFromTable() {
|
|
33
|
+
return HashIdentity_Structural();
|
|
34
|
+
}
|
|
35
|
+
export function Operators_Failure(message) {
|
|
36
|
+
return new Exception(message);
|
|
37
|
+
}
|
|
38
|
+
export function Operators_FailurePattern(exn) {
|
|
39
|
+
return exn.message;
|
|
40
|
+
}
|
|
41
|
+
export function Operators_NullArg(argumentName) {
|
|
42
|
+
throw ArgumentNullException_$ctor_Z721C83C5(argumentName);
|
|
43
|
+
}
|
|
44
|
+
export function Operators_Using(resource, action) {
|
|
45
|
+
try {
|
|
46
|
+
return action(resource);
|
|
47
|
+
}
|
|
48
|
+
finally {
|
|
49
|
+
if (equals(resource, defaultOf())) {
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
let copyOfStruct = resource;
|
|
53
|
+
disposeSafe(copyOfStruct);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
export function Operators_Lock(_lockObj, action) {
|
|
58
|
+
return action();
|
|
59
|
+
}
|
|
60
|
+
export function Operators_IsNull(value) {
|
|
61
|
+
if (equals(value, defaultOf())) {
|
|
62
|
+
return true;
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
return false;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
export function Operators_IsNotNull(value) {
|
|
69
|
+
if (equals(value, defaultOf())) {
|
|
70
|
+
return false;
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
return true;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
export function Operators_IsNullV(value) {
|
|
77
|
+
return !(value != null);
|
|
78
|
+
}
|
|
79
|
+
export function Operators_NonNull(value) {
|
|
80
|
+
if (equals(value, defaultOf())) {
|
|
81
|
+
throw NullReferenceException_$ctor();
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
return value;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
export function Operators_NonNullV(value) {
|
|
88
|
+
if (value != null) {
|
|
89
|
+
return nonNullValue(value);
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
throw NullReferenceException_$ctor();
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
export function Operators_NullMatchPattern(value) {
|
|
96
|
+
if (equals(value, defaultOf())) {
|
|
97
|
+
return FSharpChoice$2_Choice1Of2(undefined);
|
|
98
|
+
}
|
|
99
|
+
else {
|
|
100
|
+
return FSharpChoice$2_Choice2Of2(value);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
export function Operators_NullValueMatchPattern(value) {
|
|
104
|
+
if (value != null) {
|
|
105
|
+
return FSharpChoice$2_Choice2Of2(nonNullValue(value));
|
|
106
|
+
}
|
|
107
|
+
else {
|
|
108
|
+
return FSharpChoice$2_Choice1Of2(undefined);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
export function Operators_NonNullQuickPattern(value) {
|
|
112
|
+
if (equals(value, defaultOf())) {
|
|
113
|
+
throw NullReferenceException_$ctor();
|
|
114
|
+
}
|
|
115
|
+
else {
|
|
116
|
+
return value;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
export function Operators_NonNullQuickValuePattern(value) {
|
|
120
|
+
if (value != null) {
|
|
121
|
+
return nonNullValue(value);
|
|
122
|
+
}
|
|
123
|
+
else {
|
|
124
|
+
throw NullReferenceException_$ctor();
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
export function Operators_WithNull(value) {
|
|
128
|
+
return value;
|
|
129
|
+
}
|
|
130
|
+
export function Operators_WithNullV(value) {
|
|
131
|
+
return value;
|
|
132
|
+
}
|
|
133
|
+
export function Operators_NullV() {
|
|
134
|
+
return null;
|
|
135
|
+
}
|
|
136
|
+
export function Operators_NullArgCheck(argumentName, value) {
|
|
137
|
+
if (equals(value, defaultOf())) {
|
|
138
|
+
throw ArgumentNullException_$ctor_Z721C83C5(argumentName);
|
|
139
|
+
}
|
|
140
|
+
else {
|
|
141
|
+
return value;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
export function ExtraTopLevelOperators_LazyPattern(input) {
|
|
145
|
+
return input.Value;
|
|
146
|
+
}
|
|
147
|
+
export function PrintfModule_PrintFormatToStringBuilderThen(continuation, builder, format) {
|
|
148
|
+
return format.cont((s) => {
|
|
149
|
+
StringBuilder__Append_Z721C83C5(builder, s);
|
|
150
|
+
return continuation();
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
export function PrintfModule_PrintFormatToStringBuilder(builder, format) {
|
|
154
|
+
return PrintfModule_PrintFormatToStringBuilderThen(() => {
|
|
155
|
+
}, builder, format);
|
|
156
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
// This library doesn't depend on @types/node (to stay browser-compatible),
|
|
2
|
+
// so this Node.js built-in import can't be type-checked; the exported
|
|
3
|
+
// functions below still declare their own types for callers to rely on.
|
|
4
|
+
// @ts-ignore
|
|
5
|
+
import { readFileSync, writeFileSync } from "node:fs";
|
|
6
|
+
// byte[] is represented as a plain JS/TS array of numbers, not a typed array
|
|
7
|
+
// (see e.g. BitConverter.ts), so convert the Buffer returned by readFileSync.
|
|
8
|
+
export function readAllBytes(path) {
|
|
9
|
+
return Array.from(readFileSync(path));
|
|
10
|
+
}
|
|
11
|
+
export function readAllLines(path) {
|
|
12
|
+
const lines = readFileSync(path, "utf8").split(/\r\n|\r|\n/);
|
|
13
|
+
if (lines[lines.length - 1] === "") {
|
|
14
|
+
lines.pop();
|
|
15
|
+
}
|
|
16
|
+
return lines;
|
|
17
|
+
}
|
|
18
|
+
export function readAllText(path) {
|
|
19
|
+
return readFileSync(path, "utf8");
|
|
20
|
+
}
|
|
21
|
+
export function writeAllBytes(path, bytes) {
|
|
22
|
+
// Convert back from the plain array representation to a typed array Node's fs accepts.
|
|
23
|
+
writeFileSync(path, Uint8Array.from(bytes));
|
|
24
|
+
}
|
|
25
|
+
export function writeAllLines(path, lines) {
|
|
26
|
+
writeFileSync(path, lines.join("\n"));
|
|
27
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export const SR_indexOutOfBounds = "The index was outside the range of elements in the collection.";
|
|
2
|
+
export const SR_inputWasEmpty = "Collection was empty.";
|
|
3
|
+
export const SR_inputMustBeNonNegative = "The input must be non-negative.";
|
|
4
|
+
export const SR_inputSequenceEmpty = "The input sequence was empty.";
|
|
5
|
+
export const SR_inputSequenceTooLong = "The input sequence contains more than one element.";
|
|
6
|
+
export const SR_keyNotFoundAlt = "An index satisfying the predicate was not found in the collection.";
|
|
7
|
+
export const SR_differentLengths = "The collections had different lengths.";
|
|
8
|
+
export const SR_notEnoughElements = "The input sequence has an insufficient number of elements.";
|
|
9
|
+
export const SR_Arg_ApplicationException = "Error in the application.";
|
|
10
|
+
export const SR_Arg_ArgumentException = "Value does not fall within the expected range.";
|
|
11
|
+
export const SR_Arg_ArgumentOutOfRangeException = "Specified argument was out of the range of valid values.";
|
|
12
|
+
export const SR_ArgumentNull_Generic = "Value cannot be null.";
|
|
13
|
+
export const SR_Arg_ParamName_Name = " (Parameter \'";
|
|
14
|
+
export const SR_Arg_ArithmeticException = "Overflow or underflow in the arithmetic operation.";
|
|
15
|
+
export const SR_Arg_DivideByZero = "Attempted to divide by zero.";
|
|
16
|
+
export const SR_Arg_FormatException = "One of the identified items was in an invalid format.";
|
|
17
|
+
export const SR_Arg_IndexOutOfRangeException = "Index was outside the bounds of the array.";
|
|
18
|
+
export const SR_Arg_InvalidOperationException = "Operation is not valid due to the current state of the object.";
|
|
19
|
+
export const SR_Arg_KeyNotFound = "The given key was not present in the dictionary.";
|
|
20
|
+
export const SR_Arg_NotFiniteNumberException = "Number encountered was not a finite quantity.";
|
|
21
|
+
export const SR_Arg_NotImplementedException = "The method or operation is not implemented.";
|
|
22
|
+
export const SR_Arg_NotSupportedException = "Specified method is not supported.";
|
|
23
|
+
export const SR_Arg_NullReferenceException = "Object reference not set to an instance of an object.";
|
|
24
|
+
export const SR_Arg_OutOfMemoryException = "Insufficient memory to continue the execution of the program.";
|
|
25
|
+
export const SR_Arg_OverflowException = "Arithmetic operation resulted in an overflow.";
|
|
26
|
+
export const SR_Arg_RankException = "Attempted to operate on an array with the incorrect number of dimensions.";
|
|
27
|
+
export const SR_Arg_StackOverflowException = "Operation caused a stack overflow.";
|
|
28
|
+
export const SR_Arg_SystemException = "System error.";
|
|
29
|
+
export const SR_Arg_TimeoutException = "The operation has timed out.";
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import { trim } from "./String.js";
|
|
2
|
+
import { Exception } from "./Util.js";
|
|
3
|
+
// RFC 4122 compliant. From https://stackoverflow.com/a/13653180/3922220
|
|
4
|
+
// const guidRegex = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/;
|
|
5
|
+
// Relax GUID parsing, see #1637
|
|
6
|
+
const guidRegex = /^[\(\{]{0,2}[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}[\)\}]{0,2}$/;
|
|
7
|
+
const guidRegexNoHyphen = /^([0-9a-f]{8})([0-9a-f]{4})([0-9a-f]{4})([0-9a-f]{4})([0-9a-f]{12})$/;
|
|
8
|
+
const guidRegexHex = /^\{0x[0-9a-f]{8},(0x[0-9a-f]{4},){2}\{(0x[0-9a-f]{2},){7}0x[0-9a-f]{2}\}\}$/;
|
|
9
|
+
const guidHexCaptures = /^([0-9a-f]{8})-(([0-9a-f]{4})-)(([0-9a-f]{4})-)([0-9a-f]{2})([0-9a-f]{2})-([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/;
|
|
10
|
+
export function toString(str, format, _provider) {
|
|
11
|
+
if (format && format?.length > 0) {
|
|
12
|
+
switch (format) {
|
|
13
|
+
case "N":
|
|
14
|
+
return str.replace(/-/g, '');
|
|
15
|
+
case "D":
|
|
16
|
+
return str;
|
|
17
|
+
case "B":
|
|
18
|
+
return "{" + str + "}";
|
|
19
|
+
case "P":
|
|
20
|
+
return "(" + str + ")";
|
|
21
|
+
case "X":
|
|
22
|
+
return str.replace(guidHexCaptures, "{0x$1,0x$3,0x$5,{0x$6,0x$7,0x$8,0x$9,0x$10,0x$11,0x$12,0x$13}}");
|
|
23
|
+
default:
|
|
24
|
+
throw new Exception("Unrecognized Guid print format");
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
return str;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
/** Validates UUID as specified in RFC4122 (versions 1-5). */
|
|
32
|
+
export function parse(str) {
|
|
33
|
+
function hyphenateGuid(str) {
|
|
34
|
+
return str.replace(guidRegexNoHyphen, "$1-$2-$3-$4-$5");
|
|
35
|
+
}
|
|
36
|
+
const wsTrimAndLowered = str.trim().toLowerCase();
|
|
37
|
+
if (guidRegex.test(wsTrimAndLowered)) {
|
|
38
|
+
return trim(wsTrimAndLowered, "{", "}", "(", ")");
|
|
39
|
+
}
|
|
40
|
+
else if (guidRegexNoHyphen.test(wsTrimAndLowered)) {
|
|
41
|
+
return hyphenateGuid(wsTrimAndLowered);
|
|
42
|
+
}
|
|
43
|
+
else if (guidRegexHex.test(wsTrimAndLowered)) {
|
|
44
|
+
return hyphenateGuid(wsTrimAndLowered.replace(/[\{\},]|0x/g, ''));
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
throw new Exception("Guid should contain 32 digits with 4 dashes: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx");
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
export function tryParse(str, defValue) {
|
|
51
|
+
try {
|
|
52
|
+
defValue.contents = parse(str);
|
|
53
|
+
return true;
|
|
54
|
+
}
|
|
55
|
+
catch {
|
|
56
|
+
return false;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
export function newGuid() {
|
|
60
|
+
const bytes = new Uint8Array(16);
|
|
61
|
+
crypto.getRandomValues(bytes);
|
|
62
|
+
bytes[6] = (bytes[6] & 0x0f) | 0x40; // version 4
|
|
63
|
+
bytes[8] = (bytes[8] & 0x3f) | 0x80; // variant 1
|
|
64
|
+
const hex = Array.from(bytes, b => b.toString(16).padStart(2, "0")).join("");
|
|
65
|
+
return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20)}`;
|
|
66
|
+
}
|
|
67
|
+
// RFC 9562 UUID v7
|
|
68
|
+
export function createVersion7(timestamp) {
|
|
69
|
+
// A number/bigint timestamp is Unix milliseconds (used by the Temporal representation,
|
|
70
|
+
// whose DateTimeOffset is not a JS Date); a Date uses getTime().
|
|
71
|
+
const ms = timestamp == null ? Date.now() : typeof timestamp === "object" ? timestamp.getTime() : Number(timestamp);
|
|
72
|
+
// 48-bit timestamp as hex
|
|
73
|
+
const msHex = Math.floor(ms).toString(16).padStart(12, "0");
|
|
74
|
+
// random bits
|
|
75
|
+
const bytes = new Uint8Array(10);
|
|
76
|
+
crypto.getRandomValues(bytes);
|
|
77
|
+
const view = new DataView(bytes.buffer);
|
|
78
|
+
const randA = view.getUint16(0) & 0x0fff; // 12 bits
|
|
79
|
+
const randB1 = view.getUint16(2) & 0x3fff; // 14 bits
|
|
80
|
+
const randB2 = view.getUint32(4); // 32 bits
|
|
81
|
+
const randB3 = view.getUint16(8); // 16 bits
|
|
82
|
+
const timeLow = msHex.slice(0, 8);
|
|
83
|
+
const timeMid = msHex.slice(8, 12);
|
|
84
|
+
const ver = (0x7000 | randA).toString(16).padStart(4, "0");
|
|
85
|
+
const variantAndRandB = (0x8000 | randB1).toString(16).padStart(4, "0");
|
|
86
|
+
const node = randB2.toString(16).padStart(8, "0") + randB3.toString(16).padStart(4, "0");
|
|
87
|
+
return `${timeLow}-${timeMid}-${ver}-${variantAndRandB}-${node}`;
|
|
88
|
+
}
|
|
89
|
+
// Maps for number <-> hex string conversion
|
|
90
|
+
let _convertMapsInitialized = false;
|
|
91
|
+
let _byteToHex;
|
|
92
|
+
let _hexToByte;
|
|
93
|
+
function initConvertMaps() {
|
|
94
|
+
_byteToHex = new Array(256);
|
|
95
|
+
_hexToByte = {};
|
|
96
|
+
for (let i = 0; i < 256; i++) {
|
|
97
|
+
_byteToHex[i] = i.toString(16).padStart(2, '0');
|
|
98
|
+
_hexToByte[_byteToHex[i]] = i;
|
|
99
|
+
}
|
|
100
|
+
_convertMapsInitialized = true;
|
|
101
|
+
}
|
|
102
|
+
/** Parse a UUID into it's component bytes */
|
|
103
|
+
// Adapted from https://github.com/zefferus/uuid-parse
|
|
104
|
+
export function guidToArray(s) {
|
|
105
|
+
if (!_convertMapsInitialized) {
|
|
106
|
+
initConvertMaps();
|
|
107
|
+
}
|
|
108
|
+
let i = 0;
|
|
109
|
+
const buf = new Uint8Array(16);
|
|
110
|
+
s.toLowerCase().replace(/[0-9a-f]{2}/g, ((oct) => {
|
|
111
|
+
switch (i) {
|
|
112
|
+
// .NET saves first three byte groups with different endianness
|
|
113
|
+
// See https://stackoverflow.com/a/16722909/3922220
|
|
114
|
+
case 0:
|
|
115
|
+
case 1:
|
|
116
|
+
case 2:
|
|
117
|
+
case 3:
|
|
118
|
+
buf[3 - i++] = _hexToByte[oct];
|
|
119
|
+
break;
|
|
120
|
+
case 4:
|
|
121
|
+
case 5:
|
|
122
|
+
buf[9 - i++] = _hexToByte[oct];
|
|
123
|
+
break;
|
|
124
|
+
case 6:
|
|
125
|
+
case 7:
|
|
126
|
+
buf[13 - i++] = _hexToByte[oct];
|
|
127
|
+
break;
|
|
128
|
+
case 8:
|
|
129
|
+
case 9:
|
|
130
|
+
case 10:
|
|
131
|
+
case 11:
|
|
132
|
+
case 12:
|
|
133
|
+
case 13:
|
|
134
|
+
case 14:
|
|
135
|
+
case 15:
|
|
136
|
+
buf[i++] = _hexToByte[oct];
|
|
137
|
+
break;
|
|
138
|
+
}
|
|
139
|
+
}));
|
|
140
|
+
// Zero out remaining bytes if string was short
|
|
141
|
+
while (i < 16) {
|
|
142
|
+
buf[i++] = 0;
|
|
143
|
+
}
|
|
144
|
+
return buf;
|
|
145
|
+
}
|
|
146
|
+
/** Convert UUID byte array into a string */
|
|
147
|
+
export function arrayToGuid(buf) {
|
|
148
|
+
if (buf.length !== 16) {
|
|
149
|
+
throw new Exception("Byte array for GUID must be exactly 16 bytes long");
|
|
150
|
+
}
|
|
151
|
+
if (!_convertMapsInitialized) {
|
|
152
|
+
initConvertMaps();
|
|
153
|
+
}
|
|
154
|
+
const guid = _byteToHex[buf[3]] + _byteToHex[buf[2]] +
|
|
155
|
+
_byteToHex[buf[1]] + _byteToHex[buf[0]] + "-" +
|
|
156
|
+
_byteToHex[buf[5]] + _byteToHex[buf[4]] + "-" +
|
|
157
|
+
_byteToHex[buf[7]] + _byteToHex[buf[6]] + "-" +
|
|
158
|
+
_byteToHex[buf[8]] + _byteToHex[buf[9]] + "-" +
|
|
159
|
+
_byteToHex[buf[10]] + _byteToHex[buf[11]] +
|
|
160
|
+
_byteToHex[buf[12]] + _byteToHex[buf[13]] +
|
|
161
|
+
_byteToHex[buf[14]] + _byteToHex[buf[15]];
|
|
162
|
+
return guid;
|
|
163
|
+
}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import { Exception } from "./Util.js";
|
|
2
|
+
export const NumberStyles = {
|
|
3
|
+
// None: 0x00000000,
|
|
4
|
+
// AllowLeadingWhite: 0x00000001,
|
|
5
|
+
// AllowTrailingWhite: 0x00000002,
|
|
6
|
+
// AllowLeadingSign: 0x00000004,
|
|
7
|
+
// AllowTrailingSign: 0x00000008,
|
|
8
|
+
// AllowParentheses: 0x00000010,
|
|
9
|
+
// AllowDecimalPoint: 0x00000020,
|
|
10
|
+
// AllowThousands: 0x00000040,
|
|
11
|
+
// AllowExponent: 0x00000080,
|
|
12
|
+
// AllowCurrencySymbol: 0x00000100,
|
|
13
|
+
AllowHexSpecifier: 0x00000200,
|
|
14
|
+
// Integer = AllowLeadingWhite | AllowTrailingWhite | AllowLeadingSign,
|
|
15
|
+
// HexNumber = AllowLeadingWhite | AllowTrailingWhite | AllowHexSpecifier,
|
|
16
|
+
// Number = AllowLeadingWhite | AllowTrailingWhite | AllowLeadingSign |
|
|
17
|
+
// AllowTrailingSign | AllowDecimalPoint | AllowThousands,
|
|
18
|
+
// Float = AllowLeadingWhite | AllowTrailingWhite | AllowLeadingSign |
|
|
19
|
+
// AllowDecimalPoint | AllowExponent,
|
|
20
|
+
// Currency = AllowLeadingWhite | AllowTrailingWhite | AllowLeadingSign | AllowTrailingSign |
|
|
21
|
+
// AllowParentheses | AllowDecimalPoint | AllowThousands | AllowCurrencySymbol,
|
|
22
|
+
// Any = AllowLeadingWhite | AllowTrailingWhite | AllowLeadingSign | AllowTrailingSign |
|
|
23
|
+
// AllowParentheses | AllowDecimalPoint | AllowThousands | AllowCurrencySymbol | AllowExponent,
|
|
24
|
+
};
|
|
25
|
+
function validResponse(regexMatch, radix) {
|
|
26
|
+
const [/*all*/ , sign, prefix, digits] = regexMatch;
|
|
27
|
+
return {
|
|
28
|
+
sign: sign || "",
|
|
29
|
+
prefix: prefix || "",
|
|
30
|
+
digits,
|
|
31
|
+
radix,
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
function getRange(unsigned, bitsize) {
|
|
35
|
+
switch (bitsize) {
|
|
36
|
+
case 8: return unsigned ? [0, 255] : [-128, 127];
|
|
37
|
+
case 16: return unsigned ? [0, 65535] : [-32768, 32767];
|
|
38
|
+
case 32: return unsigned ? [0, 4294967295] : [-2147483648, 2147483647];
|
|
39
|
+
default: throw new Exception("Invalid bit size.");
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
function getInvalidDigits(radix) {
|
|
43
|
+
switch (radix) {
|
|
44
|
+
case 2: return /[^0-1]/;
|
|
45
|
+
case 8: return /[^0-7]/;
|
|
46
|
+
case 10: return /[^0-9]/;
|
|
47
|
+
case 16: return /[^0-9a-fA-F]/;
|
|
48
|
+
default:
|
|
49
|
+
throw new Exception("Invalid Base.");
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
export function getPrefix(radix) {
|
|
53
|
+
switch (radix) {
|
|
54
|
+
case 2: return "0b";
|
|
55
|
+
case 8: return "0o";
|
|
56
|
+
case 10: return "";
|
|
57
|
+
case 16: return "0x";
|
|
58
|
+
default: return "";
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
export function getRadix(prefix, style) {
|
|
62
|
+
if (style & NumberStyles.AllowHexSpecifier) {
|
|
63
|
+
return 16;
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
switch (prefix) {
|
|
67
|
+
case "0b":
|
|
68
|
+
case "0B": return 2;
|
|
69
|
+
case "0o":
|
|
70
|
+
case "0O": return 8;
|
|
71
|
+
case "0x":
|
|
72
|
+
case "0X": return 16;
|
|
73
|
+
default: return 10;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
export function isValid(str, style, radix) {
|
|
78
|
+
const integerRegex = /^\s*([\+\-])?(0[xXoObB])?([0-9a-fA-F]+)\s*$/;
|
|
79
|
+
const res = integerRegex.exec(str.replace(/_/g, ""));
|
|
80
|
+
if (res != null) {
|
|
81
|
+
const [/*all*/ , /*sign*/ , prefix, digits] = res;
|
|
82
|
+
radix = radix || getRadix(prefix, style);
|
|
83
|
+
const invalidDigits = getInvalidDigits(radix);
|
|
84
|
+
if (!invalidDigits.test(digits)) {
|
|
85
|
+
return validResponse(res, radix);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
return null;
|
|
89
|
+
}
|
|
90
|
+
export function parse(str, style, unsigned, bitsize, radix) {
|
|
91
|
+
const res = isValid(str, style, radix);
|
|
92
|
+
if (res != null) {
|
|
93
|
+
let v = Number.parseInt(res.sign + res.digits, res.radix);
|
|
94
|
+
if (!Number.isNaN(v)) {
|
|
95
|
+
const [umin, umax] = getRange(true, bitsize);
|
|
96
|
+
if (!unsigned && res.radix !== 10 && v >= umin && v <= umax) {
|
|
97
|
+
v = v << (32 - bitsize) >> (32 - bitsize);
|
|
98
|
+
}
|
|
99
|
+
const [min, max] = getRange(unsigned, bitsize);
|
|
100
|
+
if (v >= min && v <= max) {
|
|
101
|
+
return v;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
throw new Exception(`The input string ${str} was not in a correct format.`);
|
|
106
|
+
}
|
|
107
|
+
export function tryParse(str, style, unsigned, bitsize, defValue) {
|
|
108
|
+
try {
|
|
109
|
+
defValue.contents = parse(str, style, unsigned, bitsize);
|
|
110
|
+
return true;
|
|
111
|
+
}
|
|
112
|
+
catch {
|
|
113
|
+
return false;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
export function op_UnaryNegation_Int8(x) {
|
|
117
|
+
return x === -128 ? x : -x;
|
|
118
|
+
}
|
|
119
|
+
export function op_UnaryNegation_Int16(x) {
|
|
120
|
+
return x === -32768 ? x : -x;
|
|
121
|
+
}
|
|
122
|
+
export function op_UnaryNegation_Int32(x) {
|
|
123
|
+
return x === -2147483648 ? x : -x;
|
|
124
|
+
}
|
|
125
|
+
export function divRem(x, y, out) {
|
|
126
|
+
const div = ~~(x / y);
|
|
127
|
+
const rem = x % y;
|
|
128
|
+
if (out === void 0) {
|
|
129
|
+
return [div, rem];
|
|
130
|
+
}
|
|
131
|
+
else {
|
|
132
|
+
out.contents = rem;
|
|
133
|
+
return div;
|
|
134
|
+
}
|
|
135
|
+
}
|