typescript-to-lua 1.8.2 → 1.10.0
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/CompilerOptions.d.ts +1 -0
- package/dist/CompilerOptions.js +1 -0
- package/dist/LuaAST.d.ts +43 -37
- package/dist/LuaAST.js +48 -38
- package/dist/LuaLib.d.ts +12 -6
- package/dist/LuaLib.js +31 -21
- package/dist/LuaPrinter.d.ts +1 -0
- package/dist/LuaPrinter.js +10 -4
- package/dist/lualib/5.0/ArrayConcat.lua +22 -0
- package/dist/lualib/{ArrayEntries.lua → 5.0/ArrayEntries.lua} +0 -0
- package/dist/lualib/5.0/ArrayEvery.lua +8 -0
- package/dist/lualib/5.0/ArrayFilter.lua +11 -0
- package/dist/lualib/5.0/ArrayFind.lua +9 -0
- package/dist/lualib/5.0/ArrayFindIndex.lua +8 -0
- package/dist/lualib/5.0/ArrayFlat.lua +27 -0
- package/dist/lualib/5.0/ArrayFlatMap.lua +17 -0
- package/dist/lualib/5.0/ArrayForEach.lua +5 -0
- package/dist/lualib/5.0/ArrayFrom.lua +29 -0
- package/dist/lualib/5.0/ArrayIncludes.lua +19 -0
- package/dist/lualib/5.0/ArrayIndexOf.lua +24 -0
- package/dist/lualib/{ArrayIsArray.lua → 5.0/ArrayIsArray.lua} +0 -0
- package/dist/lualib/5.0/ArrayJoin.lua +10 -0
- package/dist/lualib/5.0/ArrayMap.lua +7 -0
- package/dist/lualib/5.0/ArrayPush.lua +9 -0
- package/dist/lualib/5.0/ArrayPushArray.lua +8 -0
- package/dist/lualib/5.0/ArrayReduce.lua +23 -0
- package/dist/lualib/5.0/ArrayReduceRight.lua +23 -0
- package/dist/lualib/5.0/ArrayReverse.lua +12 -0
- package/dist/lualib/5.0/ArraySetLength.lua +12 -0
- package/dist/lualib/5.0/ArraySlice.lua +43 -0
- package/dist/lualib/5.0/ArraySome.lua +8 -0
- package/dist/lualib/{ArraySort.lua → 5.0/ArraySort.lua} +0 -0
- package/dist/lualib/5.0/ArraySplice.lua +77 -0
- package/dist/lualib/5.0/ArrayToObject.lua +7 -0
- package/dist/lualib/5.0/ArrayUnshift.lua +14 -0
- package/dist/lualib/{Await.lua → 5.0/Await.lua} +0 -0
- package/dist/lualib/{Class.lua → 5.0/Class.lua} +0 -0
- package/dist/lualib/{ClassExtends.lua → 5.0/ClassExtends.lua} +0 -0
- package/dist/lualib/{CloneDescriptor.lua → 5.0/CloneDescriptor.lua} +0 -0
- package/dist/lualib/5.0/CountVarargs.lua +4 -0
- package/dist/lualib/5.0/Decorate.lua +36 -0
- package/dist/lualib/{DecorateParam.lua → 5.0/DecorateParam.lua} +0 -0
- package/dist/lualib/5.0/DelegatedYield.lua +34 -0
- package/dist/lualib/{Delete.lua → 5.0/Delete.lua} +0 -0
- package/dist/lualib/5.0/Error.lua +85 -0
- package/dist/lualib/5.0/FunctionBind.lua +11 -0
- package/dist/lualib/5.0/Generator.lua +34 -0
- package/dist/lualib/{InstanceOf.lua → 5.0/InstanceOf.lua} +0 -0
- package/dist/lualib/{InstanceOfObject.lua → 5.0/InstanceOfObject.lua} +0 -0
- package/dist/lualib/5.0/Iterator.lua +40 -0
- package/dist/lualib/5.0/LuaIteratorSpread.lua +9 -0
- package/dist/lualib/{Map.lua → 5.0/Map.lua} +0 -0
- package/dist/lualib/5.0/Match.lua +13 -0
- package/dist/lualib/{MathAtan2.lua → 5.0/MathAtan2.lua} +0 -0
- package/dist/lualib/5.0/MathModf.lua +10 -0
- package/dist/lualib/{MathSign.lua → 5.0/MathSign.lua} +0 -0
- package/dist/lualib/5.0/Modulo50.lua +3 -0
- package/dist/lualib/5.0/New.lua +5 -0
- package/dist/lualib/5.0/Number.lua +26 -0
- package/dist/lualib/5.0/NumberIsFinite.lua +3 -0
- package/dist/lualib/{NumberIsNaN.lua → 5.0/NumberIsNaN.lua} +0 -0
- package/dist/lualib/5.0/NumberToString.lua +47 -0
- package/dist/lualib/5.0/ObjectAssign.lua +10 -0
- package/dist/lualib/{ObjectDefineProperty.lua → 5.0/ObjectDefineProperty.lua} +0 -0
- package/dist/lualib/{ObjectEntries.lua → 5.0/ObjectEntries.lua} +0 -0
- package/dist/lualib/{ObjectFromEntries.lua → 5.0/ObjectFromEntries.lua} +0 -0
- package/dist/lualib/{ObjectGetOwnPropertyDescriptor.lua → 5.0/ObjectGetOwnPropertyDescriptor.lua} +0 -0
- package/dist/lualib/{ObjectGetOwnPropertyDescriptors.lua → 5.0/ObjectGetOwnPropertyDescriptors.lua} +0 -0
- package/dist/lualib/{ObjectKeys.lua → 5.0/ObjectKeys.lua} +0 -0
- package/dist/lualib/{ObjectRest.lua → 5.0/ObjectRest.lua} +0 -0
- package/dist/lualib/{ObjectValues.lua → 5.0/ObjectValues.lua} +0 -0
- package/dist/lualib/5.0/ParseFloat.lua +18 -0
- package/dist/lualib/5.0/ParseInt.lua +49 -0
- package/dist/lualib/5.0/Promise.lua +176 -0
- package/dist/lualib/{PromiseAll.lua → 5.0/PromiseAll.lua} +0 -0
- package/dist/lualib/{PromiseAllSettled.lua → 5.0/PromiseAllSettled.lua} +0 -0
- package/dist/lualib/5.0/PromiseAny.lua +41 -0
- package/dist/lualib/5.0/PromiseRace.lua +28 -0
- package/dist/lualib/{Set.lua → 5.0/Set.lua} +0 -0
- package/dist/lualib/{SetDescriptor.lua → 5.0/SetDescriptor.lua} +0 -0
- package/dist/lualib/5.0/SourceMapTraceBack.lua +56 -0
- package/dist/lualib/5.0/SparseArrayNew.lua +5 -0
- package/dist/lualib/5.0/SparseArrayPush.lua +9 -0
- package/dist/lualib/5.0/SparseArraySpread.lua +3 -0
- package/dist/lualib/5.0/Spread.lua +15 -0
- package/dist/lualib/5.0/StringAccess.lua +5 -0
- package/dist/lualib/{StringCharAt.lua → 5.0/StringCharAt.lua} +0 -0
- package/dist/lualib/{StringCharCodeAt.lua → 5.0/StringCharCodeAt.lua} +0 -0
- package/dist/lualib/5.0/StringEndsWith.lua +10 -0
- package/dist/lualib/{StringIncludes.lua → 5.0/StringIncludes.lua} +0 -0
- package/dist/lualib/5.0/StringPadEnd.lua +26 -0
- package/dist/lualib/5.0/StringPadStart.lua +26 -0
- package/dist/lualib/{StringReplace.lua → 5.0/StringReplace.lua} +0 -0
- package/dist/lualib/5.0/StringReplaceAll.lua +42 -0
- package/dist/lualib/{StringSlice.lua → 5.0/StringSlice.lua} +0 -0
- package/dist/lualib/5.0/StringSplit.lua +36 -0
- package/dist/lualib/5.0/StringStartsWith.lua +10 -0
- package/dist/lualib/{StringSubstr.lua → 5.0/StringSubstr.lua} +0 -0
- package/dist/lualib/{StringSubstring.lua → 5.0/StringSubstring.lua} +0 -0
- package/dist/lualib/{StringTrim.lua → 5.0/StringTrim.lua} +0 -0
- package/dist/lualib/{StringTrimEnd.lua → 5.0/StringTrimEnd.lua} +0 -0
- package/dist/lualib/{StringTrimStart.lua → 5.0/StringTrimStart.lua} +0 -0
- package/dist/lualib/{Symbol.lua → 5.0/Symbol.lua} +0 -0
- package/dist/lualib/{SymbolRegistry.lua → 5.0/SymbolRegistry.lua} +0 -0
- package/dist/lualib/{TypeOf.lua → 5.0/TypeOf.lua} +0 -0
- package/dist/lualib/5.0/Unpack.lua +1 -0
- package/dist/lualib/{WeakMap.lua → 5.0/WeakMap.lua} +0 -0
- package/dist/lualib/{WeakSet.lua → 5.0/WeakSet.lua} +0 -0
- package/dist/lualib/5.0/lualib_bundle.lua +2574 -0
- package/dist/lualib/5.0/lualib_module_info.json +672 -0
- package/dist/lualib/{ArrayConcat.lua → universal/ArrayConcat.lua} +0 -0
- package/dist/lualib/universal/ArrayEntries.lua +13 -0
- package/dist/lualib/{ArrayEvery.lua → universal/ArrayEvery.lua} +0 -0
- package/dist/lualib/{ArrayFilter.lua → universal/ArrayFilter.lua} +0 -0
- package/dist/lualib/{ArrayFind.lua → universal/ArrayFind.lua} +0 -0
- package/dist/lualib/{ArrayFindIndex.lua → universal/ArrayFindIndex.lua} +0 -0
- package/dist/lualib/{ArrayFlat.lua → universal/ArrayFlat.lua} +0 -0
- package/dist/lualib/{ArrayFlatMap.lua → universal/ArrayFlatMap.lua} +0 -0
- package/dist/lualib/{ArrayForEach.lua → universal/ArrayForEach.lua} +0 -0
- package/dist/lualib/{ArrayFrom.lua → universal/ArrayFrom.lua} +0 -0
- package/dist/lualib/{ArrayIncludes.lua → universal/ArrayIncludes.lua} +0 -0
- package/dist/lualib/{ArrayIndexOf.lua → universal/ArrayIndexOf.lua} +0 -0
- package/dist/lualib/universal/ArrayIsArray.lua +3 -0
- package/dist/lualib/{ArrayJoin.lua → universal/ArrayJoin.lua} +0 -0
- package/dist/lualib/{ArrayMap.lua → universal/ArrayMap.lua} +0 -0
- package/dist/lualib/{ArrayPush.lua → universal/ArrayPush.lua} +0 -0
- package/dist/lualib/{ArrayPushArray.lua → universal/ArrayPushArray.lua} +0 -0
- package/dist/lualib/{ArrayReduce.lua → universal/ArrayReduce.lua} +1 -1
- package/dist/lualib/{ArrayReduceRight.lua → universal/ArrayReduceRight.lua} +1 -1
- package/dist/lualib/{ArrayReverse.lua → universal/ArrayReverse.lua} +0 -0
- package/dist/lualib/{ArraySetLength.lua → universal/ArraySetLength.lua} +0 -0
- package/dist/lualib/{ArraySlice.lua → universal/ArraySlice.lua} +0 -0
- package/dist/lualib/{ArraySome.lua → universal/ArraySome.lua} +0 -0
- package/dist/lualib/universal/ArraySort.lua +11 -0
- package/dist/lualib/{ArraySplice.lua → universal/ArraySplice.lua} +1 -1
- package/dist/lualib/{ArrayToObject.lua → universal/ArrayToObject.lua} +0 -0
- package/dist/lualib/{ArrayUnshift.lua → universal/ArrayUnshift.lua} +0 -0
- package/dist/lualib/universal/Await.lua +54 -0
- package/dist/lualib/universal/Class.lua +6 -0
- package/dist/lualib/universal/ClassExtends.lua +24 -0
- package/dist/lualib/universal/CloneDescriptor.lua +28 -0
- package/dist/lualib/universal/CountVarargs.lua +3 -0
- package/dist/lualib/{Decorate.lua → universal/Decorate.lua} +0 -0
- package/dist/lualib/universal/DecorateParam.lua +3 -0
- package/dist/lualib/{DelegatedYield.lua → universal/DelegatedYield.lua} +0 -0
- package/dist/lualib/universal/Delete.lua +19 -0
- package/dist/lualib/{Error.lua → universal/Error.lua} +7 -2
- package/dist/lualib/{FunctionBind.lua → universal/FunctionBind.lua} +0 -0
- package/dist/lualib/{Generator.lua → universal/Generator.lua} +2 -9
- package/dist/lualib/universal/InstanceOf.lua +18 -0
- package/dist/lualib/universal/InstanceOfObject.lua +4 -0
- package/dist/lualib/{Iterator.lua → universal/Iterator.lua} +0 -0
- package/dist/lualib/{LuaIteratorSpread.lua → universal/LuaIteratorSpread.lua} +0 -0
- package/dist/lualib/universal/Map.lua +140 -0
- package/dist/lualib/universal/Match.lua +1 -0
- package/dist/lualib/universal/MathAtan2.lua +1 -0
- package/dist/lualib/universal/MathModf.lua +1 -0
- package/dist/lualib/universal/MathSign.lua +8 -0
- package/dist/lualib/universal/Modulo50.lua +3 -0
- package/dist/lualib/{New.lua → universal/New.lua} +0 -0
- package/dist/lualib/{Number.lua → universal/Number.lua} +0 -0
- package/dist/lualib/{NumberIsFinite.lua → universal/NumberIsFinite.lua} +0 -0
- package/dist/lualib/universal/NumberIsNaN.lua +3 -0
- package/dist/lualib/{NumberToString.lua → universal/NumberToString.lua} +1 -1
- package/dist/lualib/{ObjectAssign.lua → universal/ObjectAssign.lua} +0 -0
- package/dist/lualib/universal/ObjectDefineProperty.lua +59 -0
- package/dist/lualib/universal/ObjectEntries.lua +9 -0
- package/dist/lualib/universal/ObjectFromEntries.lua +20 -0
- package/dist/lualib/universal/ObjectGetOwnPropertyDescriptor.lua +10 -0
- package/dist/lualib/universal/ObjectGetOwnPropertyDescriptors.lua +7 -0
- package/dist/lualib/universal/ObjectKeys.lua +9 -0
- package/dist/lualib/universal/ObjectRest.lua +9 -0
- package/dist/lualib/universal/ObjectValues.lua +9 -0
- package/dist/lualib/{ParseFloat.lua → universal/ParseFloat.lua} +2 -2
- package/dist/lualib/{ParseInt.lua → universal/ParseInt.lua} +7 -7
- package/dist/lualib/{Promise.lua → universal/Promise.lua} +0 -0
- package/dist/lualib/universal/PromiseAll.lua +44 -0
- package/dist/lualib/universal/PromiseAllSettled.lua +48 -0
- package/dist/lualib/{PromiseAny.lua → universal/PromiseAny.lua} +0 -0
- package/dist/lualib/{PromiseRace.lua → universal/PromiseRace.lua} +0 -0
- package/dist/lualib/universal/Set.lua +130 -0
- package/dist/lualib/universal/SetDescriptor.lua +79 -0
- package/dist/lualib/{SourceMapTraceBack.lua → universal/SourceMapTraceBack.lua} +3 -1
- package/dist/lualib/{SparseArrayNew.lua → universal/SparseArrayNew.lua} +1 -1
- package/dist/lualib/{SparseArrayPush.lua → universal/SparseArrayPush.lua} +1 -1
- package/dist/lualib/{SparseArraySpread.lua → universal/SparseArraySpread.lua} +0 -0
- package/dist/lualib/{Spread.lua → universal/Spread.lua} +0 -0
- package/dist/lualib/{StringAccess.lua → universal/StringAccess.lua} +0 -0
- package/dist/lualib/universal/StringCharAt.lua +9 -0
- package/dist/lualib/universal/StringCharCodeAt.lua +13 -0
- package/dist/lualib/{StringEndsWith.lua → universal/StringEndsWith.lua} +0 -0
- package/dist/lualib/universal/StringIncludes.lua +9 -0
- package/dist/lualib/{StringPadEnd.lua → universal/StringPadEnd.lua} +0 -0
- package/dist/lualib/{StringPadStart.lua → universal/StringPadStart.lua} +0 -0
- package/dist/lualib/universal/StringReplace.lua +20 -0
- package/dist/lualib/{StringReplaceAll.lua → universal/StringReplaceAll.lua} +0 -0
- package/dist/lualib/universal/StringSlice.lua +15 -0
- package/dist/lualib/{StringSplit.lua → universal/StringSplit.lua} +0 -0
- package/dist/lualib/{StringStartsWith.lua → universal/StringStartsWith.lua} +0 -0
- package/dist/lualib/universal/StringSubstr.lua +15 -0
- package/dist/lualib/universal/StringSubstring.lua +17 -0
- package/dist/lualib/universal/StringTrim.lua +4 -0
- package/dist/lualib/universal/StringTrimEnd.lua +4 -0
- package/dist/lualib/universal/StringTrimStart.lua +4 -0
- package/dist/lualib/universal/Symbol.lua +15 -0
- package/dist/lualib/universal/SymbolRegistry.lua +17 -0
- package/dist/lualib/universal/TypeOf.lua +10 -0
- package/dist/lualib/{Unpack.lua → universal/Unpack.lua} +0 -0
- package/dist/lualib/universal/WeakMap.lua +45 -0
- package/dist/lualib/universal/WeakSet.lua +41 -0
- package/dist/lualib/{lualib_bundle.lua → universal/lualib_bundle.lua} +53 -37
- package/dist/lualib/{lualib_module_info.json → universal/lualib_module_info.json} +49 -4
- package/dist/lualib-build/plugin.js +12 -2
- package/dist/transformation/builtins/array.d.ts +1 -1
- package/dist/transformation/builtins/array.js +12 -2
- package/dist/transformation/builtins/function.js +4 -2
- package/dist/transformation/builtins/index.js +11 -3
- package/dist/transformation/builtins/string.d.ts +1 -1
- package/dist/transformation/builtins/string.js +8 -1
- package/dist/transformation/utils/diagnostics.d.ts +5 -4
- package/dist/transformation/utils/diagnostics.js +2 -1
- package/dist/transformation/utils/lua-ast.js +3 -1
- package/dist/transformation/utils/typescript/index.js +2 -2
- package/dist/transformation/visitors/access.js +11 -0
- package/dist/transformation/visitors/binary-expression/bit.js +4 -2
- package/dist/transformation/visitors/binary-expression/index.js +4 -0
- package/dist/transformation/visitors/break-continue.js +4 -2
- package/dist/transformation/visitors/class/index.js +9 -4
- package/dist/transformation/visitors/class/members/fields.js +6 -2
- package/dist/transformation/visitors/class/members/method.js +4 -2
- package/dist/transformation/visitors/conditional.d.ts +1 -0
- package/dist/transformation/visitors/conditional.js +12 -1
- package/dist/transformation/visitors/errors.js +4 -2
- package/dist/transformation/visitors/function.js +2 -1
- package/dist/transformation/visitors/identifier.js +4 -1
- package/dist/transformation/visitors/language-extensions/operators.js +2 -1
- package/dist/transformation/visitors/literal.js +12 -4
- package/dist/transformation/visitors/loops/do-while.js +5 -0
- package/dist/transformation/visitors/modules/export.js +1 -1
- package/dist/transformation/visitors/spread.js +4 -1
- package/dist/transformation/visitors/typescript.js +1 -0
- package/dist/transpilation/bundle.js +15 -6
- package/dist/transpilation/resolve.js +3 -3
- package/dist/transpilation/transpiler.js +3 -1
- package/package.json +18 -18
- package/language-extensions/index.d.ts +0 -676
|
@@ -4,16 +4,16 @@ do
|
|
|
4
4
|
function __TS__ParseInt(numberString, base)
|
|
5
5
|
if base == nil then
|
|
6
6
|
base = 10
|
|
7
|
-
local hexMatch =
|
|
7
|
+
local hexMatch = __TS__Match(numberString, "^%s*-?0[xX]")
|
|
8
8
|
if hexMatch then
|
|
9
9
|
base = 16
|
|
10
|
-
local
|
|
11
|
-
if
|
|
12
|
-
|
|
10
|
+
local ____TS__Match_result__0_0
|
|
11
|
+
if __TS__Match(hexMatch, "-") then
|
|
12
|
+
____TS__Match_result__0_0 = "-" .. __TS__StringSubstr(numberString, #hexMatch)
|
|
13
13
|
else
|
|
14
|
-
|
|
14
|
+
____TS__Match_result__0_0 = __TS__StringSubstr(numberString, #hexMatch)
|
|
15
15
|
end
|
|
16
|
-
numberString =
|
|
16
|
+
numberString = ____TS__Match_result__0_0
|
|
17
17
|
end
|
|
18
18
|
end
|
|
19
19
|
if base < 2 or base > 36 then
|
|
@@ -28,7 +28,7 @@ do
|
|
|
28
28
|
local allowedDigits = ____temp_1
|
|
29
29
|
local pattern = ("^%s*(-?[" .. allowedDigits) .. "]*)"
|
|
30
30
|
local number = tonumber(
|
|
31
|
-
|
|
31
|
+
__TS__Match(numberString, pattern),
|
|
32
32
|
base
|
|
33
33
|
)
|
|
34
34
|
if number == nil then
|
|
File without changes
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
local function __TS__PromiseAll(iterable)
|
|
2
|
+
local results = {}
|
|
3
|
+
local toResolve = {}
|
|
4
|
+
local numToResolve = 0
|
|
5
|
+
local i = 0
|
|
6
|
+
for ____, item in __TS__Iterator(iterable) do
|
|
7
|
+
if __TS__InstanceOf(item, __TS__Promise) then
|
|
8
|
+
if item.state == 1 then
|
|
9
|
+
results[i + 1] = item.value
|
|
10
|
+
elseif item.state == 2 then
|
|
11
|
+
return __TS__Promise.reject(item.rejectionReason)
|
|
12
|
+
else
|
|
13
|
+
numToResolve = numToResolve + 1
|
|
14
|
+
toResolve[i] = item
|
|
15
|
+
end
|
|
16
|
+
else
|
|
17
|
+
results[i + 1] = item
|
|
18
|
+
end
|
|
19
|
+
i = i + 1
|
|
20
|
+
end
|
|
21
|
+
if numToResolve == 0 then
|
|
22
|
+
return __TS__Promise.resolve(results)
|
|
23
|
+
end
|
|
24
|
+
return __TS__New(
|
|
25
|
+
__TS__Promise,
|
|
26
|
+
function(____, resolve, reject)
|
|
27
|
+
for index, promise in pairs(toResolve) do
|
|
28
|
+
promise["then"](
|
|
29
|
+
promise,
|
|
30
|
+
function(____, data)
|
|
31
|
+
results[index + 1] = data
|
|
32
|
+
numToResolve = numToResolve - 1
|
|
33
|
+
if numToResolve == 0 then
|
|
34
|
+
resolve(nil, results)
|
|
35
|
+
end
|
|
36
|
+
end,
|
|
37
|
+
function(____, reason)
|
|
38
|
+
reject(nil, reason)
|
|
39
|
+
end
|
|
40
|
+
)
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
)
|
|
44
|
+
end
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
local function __TS__PromiseAllSettled(iterable)
|
|
2
|
+
local results = {}
|
|
3
|
+
local toResolve = {}
|
|
4
|
+
local numToResolve = 0
|
|
5
|
+
local i = 0
|
|
6
|
+
for ____, item in __TS__Iterator(iterable) do
|
|
7
|
+
if __TS__InstanceOf(item, __TS__Promise) then
|
|
8
|
+
if item.state == 1 then
|
|
9
|
+
results[i + 1] = {status = "fulfilled", value = item.value}
|
|
10
|
+
elseif item.state == 2 then
|
|
11
|
+
results[i + 1] = {status = "rejected", reason = item.rejectionReason}
|
|
12
|
+
else
|
|
13
|
+
numToResolve = numToResolve + 1
|
|
14
|
+
toResolve[i] = item
|
|
15
|
+
end
|
|
16
|
+
else
|
|
17
|
+
results[i + 1] = {status = "fulfilled", value = item}
|
|
18
|
+
end
|
|
19
|
+
i = i + 1
|
|
20
|
+
end
|
|
21
|
+
if numToResolve == 0 then
|
|
22
|
+
return __TS__Promise.resolve(results)
|
|
23
|
+
end
|
|
24
|
+
return __TS__New(
|
|
25
|
+
__TS__Promise,
|
|
26
|
+
function(____, resolve)
|
|
27
|
+
for index, promise in pairs(toResolve) do
|
|
28
|
+
promise["then"](
|
|
29
|
+
promise,
|
|
30
|
+
function(____, data)
|
|
31
|
+
results[index + 1] = {status = "fulfilled", value = data}
|
|
32
|
+
numToResolve = numToResolve - 1
|
|
33
|
+
if numToResolve == 0 then
|
|
34
|
+
resolve(nil, results)
|
|
35
|
+
end
|
|
36
|
+
end,
|
|
37
|
+
function(____, reason)
|
|
38
|
+
results[index + 1] = {status = "rejected", reason = reason}
|
|
39
|
+
numToResolve = numToResolve - 1
|
|
40
|
+
if numToResolve == 0 then
|
|
41
|
+
resolve(nil, results)
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
)
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
)
|
|
48
|
+
end
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
local Set
|
|
2
|
+
do
|
|
3
|
+
Set = __TS__Class()
|
|
4
|
+
Set.name = "Set"
|
|
5
|
+
function Set.prototype.____constructor(self, values)
|
|
6
|
+
self[Symbol.toStringTag] = "Set"
|
|
7
|
+
self.size = 0
|
|
8
|
+
self.nextKey = {}
|
|
9
|
+
self.previousKey = {}
|
|
10
|
+
if values == nil then
|
|
11
|
+
return
|
|
12
|
+
end
|
|
13
|
+
local iterable = values
|
|
14
|
+
if iterable[Symbol.iterator] then
|
|
15
|
+
local iterator = iterable[Symbol.iterator](iterable)
|
|
16
|
+
while true do
|
|
17
|
+
local result = iterator:next()
|
|
18
|
+
if result.done then
|
|
19
|
+
break
|
|
20
|
+
end
|
|
21
|
+
self:add(result.value)
|
|
22
|
+
end
|
|
23
|
+
else
|
|
24
|
+
local array = values
|
|
25
|
+
for ____, value in ipairs(array) do
|
|
26
|
+
self:add(value)
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
function Set.prototype.add(self, value)
|
|
31
|
+
local isNewValue = not self:has(value)
|
|
32
|
+
if isNewValue then
|
|
33
|
+
self.size = self.size + 1
|
|
34
|
+
end
|
|
35
|
+
if self.firstKey == nil then
|
|
36
|
+
self.firstKey = value
|
|
37
|
+
self.lastKey = value
|
|
38
|
+
elseif isNewValue then
|
|
39
|
+
self.nextKey[self.lastKey] = value
|
|
40
|
+
self.previousKey[value] = self.lastKey
|
|
41
|
+
self.lastKey = value
|
|
42
|
+
end
|
|
43
|
+
return self
|
|
44
|
+
end
|
|
45
|
+
function Set.prototype.clear(self)
|
|
46
|
+
self.nextKey = {}
|
|
47
|
+
self.previousKey = {}
|
|
48
|
+
self.firstKey = nil
|
|
49
|
+
self.lastKey = nil
|
|
50
|
+
self.size = 0
|
|
51
|
+
end
|
|
52
|
+
function Set.prototype.delete(self, value)
|
|
53
|
+
local contains = self:has(value)
|
|
54
|
+
if contains then
|
|
55
|
+
self.size = self.size - 1
|
|
56
|
+
local next = self.nextKey[value]
|
|
57
|
+
local previous = self.previousKey[value]
|
|
58
|
+
if next and previous then
|
|
59
|
+
self.nextKey[previous] = next
|
|
60
|
+
self.previousKey[next] = previous
|
|
61
|
+
elseif next then
|
|
62
|
+
self.firstKey = next
|
|
63
|
+
self.previousKey[next] = nil
|
|
64
|
+
elseif previous then
|
|
65
|
+
self.lastKey = previous
|
|
66
|
+
self.nextKey[previous] = nil
|
|
67
|
+
else
|
|
68
|
+
self.firstKey = nil
|
|
69
|
+
self.lastKey = nil
|
|
70
|
+
end
|
|
71
|
+
self.nextKey[value] = nil
|
|
72
|
+
self.previousKey[value] = nil
|
|
73
|
+
end
|
|
74
|
+
return contains
|
|
75
|
+
end
|
|
76
|
+
function Set.prototype.forEach(self, callback)
|
|
77
|
+
for ____, key in __TS__Iterator(self:keys()) do
|
|
78
|
+
callback(nil, key, key, self)
|
|
79
|
+
end
|
|
80
|
+
end
|
|
81
|
+
function Set.prototype.has(self, value)
|
|
82
|
+
return self.nextKey[value] ~= nil or self.lastKey == value
|
|
83
|
+
end
|
|
84
|
+
Set.prototype[Symbol.iterator] = function(self)
|
|
85
|
+
return self:values()
|
|
86
|
+
end
|
|
87
|
+
function Set.prototype.entries(self)
|
|
88
|
+
local nextKey = self.nextKey
|
|
89
|
+
local key = self.firstKey
|
|
90
|
+
return {
|
|
91
|
+
[Symbol.iterator] = function(self)
|
|
92
|
+
return self
|
|
93
|
+
end,
|
|
94
|
+
next = function(self)
|
|
95
|
+
local result = {done = not key, value = {key, key}}
|
|
96
|
+
key = nextKey[key]
|
|
97
|
+
return result
|
|
98
|
+
end
|
|
99
|
+
}
|
|
100
|
+
end
|
|
101
|
+
function Set.prototype.keys(self)
|
|
102
|
+
local nextKey = self.nextKey
|
|
103
|
+
local key = self.firstKey
|
|
104
|
+
return {
|
|
105
|
+
[Symbol.iterator] = function(self)
|
|
106
|
+
return self
|
|
107
|
+
end,
|
|
108
|
+
next = function(self)
|
|
109
|
+
local result = {done = not key, value = key}
|
|
110
|
+
key = nextKey[key]
|
|
111
|
+
return result
|
|
112
|
+
end
|
|
113
|
+
}
|
|
114
|
+
end
|
|
115
|
+
function Set.prototype.values(self)
|
|
116
|
+
local nextKey = self.nextKey
|
|
117
|
+
local key = self.firstKey
|
|
118
|
+
return {
|
|
119
|
+
[Symbol.iterator] = function(self)
|
|
120
|
+
return self
|
|
121
|
+
end,
|
|
122
|
+
next = function(self)
|
|
123
|
+
local result = {done = not key, value = key}
|
|
124
|
+
key = nextKey[key]
|
|
125
|
+
return result
|
|
126
|
+
end
|
|
127
|
+
}
|
|
128
|
+
end
|
|
129
|
+
Set[Symbol.species] = Set
|
|
130
|
+
end
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
local __TS__SetDescriptor
|
|
2
|
+
do
|
|
3
|
+
local function descriptorIndex(self, key)
|
|
4
|
+
local value = rawget(self, key)
|
|
5
|
+
if value ~= nil then
|
|
6
|
+
return value
|
|
7
|
+
end
|
|
8
|
+
local metatable = getmetatable(self)
|
|
9
|
+
while metatable do
|
|
10
|
+
local rawResult = rawget(metatable, key)
|
|
11
|
+
if rawResult ~= nil then
|
|
12
|
+
return rawResult
|
|
13
|
+
end
|
|
14
|
+
local descriptors = rawget(metatable, "_descriptors")
|
|
15
|
+
if descriptors then
|
|
16
|
+
local descriptor = descriptors[key]
|
|
17
|
+
if descriptor then
|
|
18
|
+
if descriptor.get then
|
|
19
|
+
return descriptor.get(self)
|
|
20
|
+
end
|
|
21
|
+
return descriptor.value
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
metatable = getmetatable(metatable)
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
local function descriptorNewIndex(self, key, value)
|
|
28
|
+
local metatable = getmetatable(self)
|
|
29
|
+
while metatable do
|
|
30
|
+
local descriptors = rawget(metatable, "_descriptors")
|
|
31
|
+
if descriptors then
|
|
32
|
+
local descriptor = descriptors[key]
|
|
33
|
+
if descriptor then
|
|
34
|
+
if descriptor.set then
|
|
35
|
+
descriptor.set(self, value)
|
|
36
|
+
else
|
|
37
|
+
if descriptor.writable == false then
|
|
38
|
+
error(
|
|
39
|
+
((("Cannot assign to read only property '" .. key) .. "' of object '") .. tostring(self)) .. "'",
|
|
40
|
+
0
|
|
41
|
+
)
|
|
42
|
+
end
|
|
43
|
+
descriptor.value = value
|
|
44
|
+
end
|
|
45
|
+
return
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
metatable = getmetatable(metatable)
|
|
49
|
+
end
|
|
50
|
+
rawset(self, key, value)
|
|
51
|
+
end
|
|
52
|
+
function __TS__SetDescriptor(target, key, desc, isPrototype)
|
|
53
|
+
if isPrototype == nil then
|
|
54
|
+
isPrototype = false
|
|
55
|
+
end
|
|
56
|
+
local ____isPrototype_0
|
|
57
|
+
if isPrototype then
|
|
58
|
+
____isPrototype_0 = target
|
|
59
|
+
else
|
|
60
|
+
____isPrototype_0 = getmetatable(target)
|
|
61
|
+
end
|
|
62
|
+
local metatable = ____isPrototype_0
|
|
63
|
+
if not metatable then
|
|
64
|
+
metatable = {}
|
|
65
|
+
setmetatable(target, metatable)
|
|
66
|
+
end
|
|
67
|
+
local value = rawget(target, key)
|
|
68
|
+
if value ~= nil then
|
|
69
|
+
rawset(target, key, nil)
|
|
70
|
+
end
|
|
71
|
+
if not rawget(metatable, "_descriptors") then
|
|
72
|
+
metatable._descriptors = {}
|
|
73
|
+
end
|
|
74
|
+
local descriptor = __TS__CloneDescriptor(desc)
|
|
75
|
+
metatable._descriptors[key] = descriptor
|
|
76
|
+
metatable.__index = descriptorIndex
|
|
77
|
+
metatable.__newindex = descriptorNewIndex
|
|
78
|
+
end
|
|
79
|
+
end
|
|
@@ -8,6 +8,8 @@ local function __TS__SourceMapTraceBack(fileName, sourceMap)
|
|
|
8
8
|
local trace
|
|
9
9
|
if thread == nil and message == nil and level == nil then
|
|
10
10
|
trace = originalTraceback()
|
|
11
|
+
elseif __TS__StringIncludes(_VERSION, "Lua 5.0") then
|
|
12
|
+
trace = originalTraceback((("[Level " .. tostring(level)) .. "] ") .. message)
|
|
11
13
|
else
|
|
12
14
|
trace = originalTraceback(thread, message, level)
|
|
13
15
|
end
|
|
@@ -33,7 +35,7 @@ local function __TS__SourceMapTraceBack(fileName, sourceMap)
|
|
|
33
35
|
local function stringReplacer(____, file, line)
|
|
34
36
|
local fileSourceMap = _G.__TS__sourcemap[file]
|
|
35
37
|
if fileSourceMap and fileSourceMap[line] then
|
|
36
|
-
local chunkName =
|
|
38
|
+
local chunkName = __TS__Match(file, "%[string \"([^\"]+)\"%]")
|
|
37
39
|
local sourceName = string.gsub(chunkName, ".lua$", ".ts")
|
|
38
40
|
local data = fileSourceMap[line]
|
|
39
41
|
if type(data) == "number" then
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
local function __TS__StringCharCodeAt(self, index)
|
|
2
|
+
if index ~= index then
|
|
3
|
+
index = 0
|
|
4
|
+
end
|
|
5
|
+
if index < 0 then
|
|
6
|
+
return 0 / 0
|
|
7
|
+
end
|
|
8
|
+
local ____string_byte_result_0 = string.byte(self, index + 1)
|
|
9
|
+
if ____string_byte_result_0 == nil then
|
|
10
|
+
____string_byte_result_0 = 0 / 0
|
|
11
|
+
end
|
|
12
|
+
return ____string_byte_result_0
|
|
13
|
+
end
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
local __TS__StringReplace
|
|
2
|
+
do
|
|
3
|
+
local sub = string.sub
|
|
4
|
+
function __TS__StringReplace(source, searchValue, replaceValue)
|
|
5
|
+
local startPos, endPos = string.find(source, searchValue, nil, true)
|
|
6
|
+
if not startPos then
|
|
7
|
+
return source
|
|
8
|
+
end
|
|
9
|
+
local before = sub(source, 1, startPos - 1)
|
|
10
|
+
local ____temp_0
|
|
11
|
+
if type(replaceValue) == "string" then
|
|
12
|
+
____temp_0 = replaceValue
|
|
13
|
+
else
|
|
14
|
+
____temp_0 = replaceValue(nil, searchValue, startPos - 1, source)
|
|
15
|
+
end
|
|
16
|
+
local replacement = ____temp_0
|
|
17
|
+
local after = sub(source, endPos + 1)
|
|
18
|
+
return (before .. replacement) .. after
|
|
19
|
+
end
|
|
20
|
+
end
|
|
File without changes
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
local function __TS__StringSlice(self, start, ____end)
|
|
2
|
+
if start == nil or start ~= start then
|
|
3
|
+
start = 0
|
|
4
|
+
end
|
|
5
|
+
if ____end ~= ____end then
|
|
6
|
+
____end = 0
|
|
7
|
+
end
|
|
8
|
+
if start >= 0 then
|
|
9
|
+
start = start + 1
|
|
10
|
+
end
|
|
11
|
+
if ____end ~= nil and ____end < 0 then
|
|
12
|
+
____end = ____end - 1
|
|
13
|
+
end
|
|
14
|
+
return string.sub(self, start, ____end)
|
|
15
|
+
end
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
local function __TS__StringSubstr(self, from, length)
|
|
2
|
+
if from ~= from then
|
|
3
|
+
from = 0
|
|
4
|
+
end
|
|
5
|
+
if length ~= nil then
|
|
6
|
+
if length ~= length or length <= 0 then
|
|
7
|
+
return ""
|
|
8
|
+
end
|
|
9
|
+
length = length + from
|
|
10
|
+
end
|
|
11
|
+
if from >= 0 then
|
|
12
|
+
from = from + 1
|
|
13
|
+
end
|
|
14
|
+
return string.sub(self, from, length)
|
|
15
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
local function __TS__StringSubstring(self, start, ____end)
|
|
2
|
+
if ____end ~= ____end then
|
|
3
|
+
____end = 0
|
|
4
|
+
end
|
|
5
|
+
if ____end ~= nil and start > ____end then
|
|
6
|
+
start, ____end = ____end, start
|
|
7
|
+
end
|
|
8
|
+
if start >= 0 then
|
|
9
|
+
start = start + 1
|
|
10
|
+
else
|
|
11
|
+
start = 1
|
|
12
|
+
end
|
|
13
|
+
if ____end ~= nil and ____end < 0 then
|
|
14
|
+
____end = 0
|
|
15
|
+
end
|
|
16
|
+
return string.sub(self, start, ____end)
|
|
17
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
local __TS__Symbol, Symbol
|
|
2
|
+
do
|
|
3
|
+
local symbolMetatable = {__tostring = function(self)
|
|
4
|
+
return ("Symbol(" .. (self.description or "")) .. ")"
|
|
5
|
+
end}
|
|
6
|
+
function __TS__Symbol(description)
|
|
7
|
+
return setmetatable({description = description}, symbolMetatable)
|
|
8
|
+
end
|
|
9
|
+
Symbol = {
|
|
10
|
+
iterator = __TS__Symbol("Symbol.iterator"),
|
|
11
|
+
hasInstance = __TS__Symbol("Symbol.hasInstance"),
|
|
12
|
+
species = __TS__Symbol("Symbol.species"),
|
|
13
|
+
toStringTag = __TS__Symbol("Symbol.toStringTag")
|
|
14
|
+
}
|
|
15
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
local __TS__SymbolRegistryFor, __TS__SymbolRegistryKeyFor
|
|
2
|
+
do
|
|
3
|
+
local symbolRegistry = {}
|
|
4
|
+
function __TS__SymbolRegistryFor(key)
|
|
5
|
+
if not symbolRegistry[key] then
|
|
6
|
+
symbolRegistry[key] = __TS__Symbol(key)
|
|
7
|
+
end
|
|
8
|
+
return symbolRegistry[key]
|
|
9
|
+
end
|
|
10
|
+
function __TS__SymbolRegistryKeyFor(sym)
|
|
11
|
+
for key in pairs(symbolRegistry) do
|
|
12
|
+
if symbolRegistry[key] == sym then
|
|
13
|
+
return key
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
File without changes
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
local WeakMap
|
|
2
|
+
do
|
|
3
|
+
WeakMap = __TS__Class()
|
|
4
|
+
WeakMap.name = "WeakMap"
|
|
5
|
+
function WeakMap.prototype.____constructor(self, entries)
|
|
6
|
+
self[Symbol.toStringTag] = "WeakMap"
|
|
7
|
+
self.items = {}
|
|
8
|
+
setmetatable(self.items, {__mode = "k"})
|
|
9
|
+
if entries == nil then
|
|
10
|
+
return
|
|
11
|
+
end
|
|
12
|
+
local iterable = entries
|
|
13
|
+
if iterable[Symbol.iterator] then
|
|
14
|
+
local iterator = iterable[Symbol.iterator](iterable)
|
|
15
|
+
while true do
|
|
16
|
+
local result = iterator:next()
|
|
17
|
+
if result.done then
|
|
18
|
+
break
|
|
19
|
+
end
|
|
20
|
+
local value = result.value
|
|
21
|
+
self.items[value[1]] = value[2]
|
|
22
|
+
end
|
|
23
|
+
else
|
|
24
|
+
for ____, kvp in ipairs(entries) do
|
|
25
|
+
self.items[kvp[1]] = kvp[2]
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
function WeakMap.prototype.delete(self, key)
|
|
30
|
+
local contains = self:has(key)
|
|
31
|
+
self.items[key] = nil
|
|
32
|
+
return contains
|
|
33
|
+
end
|
|
34
|
+
function WeakMap.prototype.get(self, key)
|
|
35
|
+
return self.items[key]
|
|
36
|
+
end
|
|
37
|
+
function WeakMap.prototype.has(self, key)
|
|
38
|
+
return self.items[key] ~= nil
|
|
39
|
+
end
|
|
40
|
+
function WeakMap.prototype.set(self, key, value)
|
|
41
|
+
self.items[key] = value
|
|
42
|
+
return self
|
|
43
|
+
end
|
|
44
|
+
WeakMap[Symbol.species] = WeakMap
|
|
45
|
+
end
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
local WeakSet
|
|
2
|
+
do
|
|
3
|
+
WeakSet = __TS__Class()
|
|
4
|
+
WeakSet.name = "WeakSet"
|
|
5
|
+
function WeakSet.prototype.____constructor(self, values)
|
|
6
|
+
self[Symbol.toStringTag] = "WeakSet"
|
|
7
|
+
self.items = {}
|
|
8
|
+
setmetatable(self.items, {__mode = "k"})
|
|
9
|
+
if values == nil then
|
|
10
|
+
return
|
|
11
|
+
end
|
|
12
|
+
local iterable = values
|
|
13
|
+
if iterable[Symbol.iterator] then
|
|
14
|
+
local iterator = iterable[Symbol.iterator](iterable)
|
|
15
|
+
while true do
|
|
16
|
+
local result = iterator:next()
|
|
17
|
+
if result.done then
|
|
18
|
+
break
|
|
19
|
+
end
|
|
20
|
+
self.items[result.value] = true
|
|
21
|
+
end
|
|
22
|
+
else
|
|
23
|
+
for ____, value in ipairs(values) do
|
|
24
|
+
self.items[value] = true
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
function WeakSet.prototype.add(self, value)
|
|
29
|
+
self.items[value] = true
|
|
30
|
+
return self
|
|
31
|
+
end
|
|
32
|
+
function WeakSet.prototype.delete(self, value)
|
|
33
|
+
local contains = self:has(value)
|
|
34
|
+
self.items[value] = nil
|
|
35
|
+
return contains
|
|
36
|
+
end
|
|
37
|
+
function WeakSet.prototype.has(self, value)
|
|
38
|
+
return self.items[value] == true
|
|
39
|
+
end
|
|
40
|
+
WeakSet[Symbol.species] = WeakSet
|
|
41
|
+
end
|