@@ -3,57 +3,13 @@ import {LuaTranspiler, TranspileResult} from "typescript-to-lua/dist/LuaTranspil
3
3
4
4
import * as ts from "typescript" ;
5
5
6
- // TODO this needs to be improved it's a mess;
7
- const luaLib : { [ key : string ] : string } = {
8
- ArrayConcat : require ( "raw-loader!../../node_modules/typescript-to-lua/dist/lualib/ArrayConcat.lua" ) ,
9
- ArrayEvery : require ( "raw-loader!../../node_modules/typescript-to-lua/dist/lualib/ArrayEvery.lua" ) ,
10
- ArrayFilter : require ( "raw-loader!../../node_modules/typescript-to-lua/dist/lualib/ArrayFilter.lua" ) ,
11
- ArrayForEach : require ( "raw-loader!../../node_modules/typescript-to-lua/dist/lualib/ArrayForEach.lua" ) ,
12
- ArrayIndexOf : require ( "raw-loader!../../node_modules/typescript-to-lua/dist/lualib/ArrayIndexOf.lua" ) ,
13
- ArrayMap : require ( "raw-loader!../../node_modules/typescript-to-lua/dist/lualib/ArrayMap.lua" ) ,
14
- ArrayPush : require ( "raw-loader!../../node_modules/typescript-to-lua/dist/lualib/ArrayPush.lua" ) ,
15
- ArrayReverse : require ( "raw-loader!../../node_modules/typescript-to-lua/dist/lualib/ArrayReverse.lua" ) ,
16
- ArrayShift : require ( "raw-loader!../../node_modules/typescript-to-lua/dist/lualib/ArrayShift.lua" ) ,
17
- ArrayUnshift : require ( "raw-loader!../../node_modules/typescript-to-lua/dist/lualib/ArrayUnshift.lua" ) ,
18
- ArraySort : require ( "raw-loader!../../node_modules/typescript-to-lua/dist/lualib/ArraySort.lua" ) ,
19
- ArraySlice : require ( "raw-loader!../../node_modules/typescript-to-lua/dist/lualib/ArraySlice.lua" ) ,
20
- ArraySome : require ( "raw-loader!../../node_modules/typescript-to-lua/dist/lualib/ArraySome.lua" ) ,
21
- ArraySplice : require ( "raw-loader!../../node_modules/typescript-to-lua/dist/lualib/ArraySplice.lua" ) ,
22
- ArrayFlat : require ( "raw-loader!../../node_modules/typescript-to-lua/dist/lualib/ArrayFlat.lua" ) ,
23
- ArrayFlatMap : require ( "raw-loader!../../node_modules/typescript-to-lua/dist/lualib/ArrayFlatMap.lua" ) ,
24
- ArraySetLength : require ( "raw-loader!../../node_modules/typescript-to-lua/dist/lualib/ArraySetLength.lua" ) ,
25
- ClassIndex : require ( "raw-loader!../../node_modules/typescript-to-lua/dist/lualib/ClassIndex.lua" ) ,
26
- ClassNewIndex : require ( "raw-loader!../../node_modules/typescript-to-lua/dist/lualib/ClassNewIndex.lua" ) ,
27
- FunctionApply : require ( "raw-loader!../../node_modules/typescript-to-lua/dist/lualib/FunctionApply.lua" ) ,
28
- FunctionBind : require ( "raw-loader!../../node_modules/typescript-to-lua/dist/lualib/FunctionBind.lua" ) ,
29
- FunctionCall : require ( "raw-loader!../../node_modules/typescript-to-lua/dist/lualib/FunctionCall.lua" ) ,
30
- Index : require ( "raw-loader!../../node_modules/typescript-to-lua/dist/lualib/Index.lua" ) ,
31
- InstanceOf : require ( "raw-loader!../../node_modules/typescript-to-lua/dist/lualib/InstanceOf.lua" ) ,
32
- Iterator : require ( "raw-loader!../../node_modules/typescript-to-lua/dist/lualib/Iterator.lua" ) ,
33
- Map : require ( "raw-loader!../../node_modules/typescript-to-lua/dist/lualib/Map.lua" ) ,
34
- NewIndex : require ( "raw-loader!../../node_modules/typescript-to-lua/dist/lualib/NewIndex.lua" ) ,
35
- ObjectAssign : require ( "raw-loader!../../node_modules/typescript-to-lua/dist/lualib/ObjectAssign.lua" ) ,
36
- ObjectEntries : require ( "raw-loader!../../node_modules/typescript-to-lua/dist/lualib/ObjectEntries.lua" ) ,
37
- ObjectFromEntries : require ( "raw-loader!../../node_modules/typescript-to-lua/dist/lualib/ObjectFromEntries.lua" ) ,
38
- ObjectKeys : require ( "raw-loader!../../node_modules/typescript-to-lua/dist/lualib/ObjectKeys.lua" ) ,
39
- ObjectValues : require ( "raw-loader!../../node_modules/typescript-to-lua/dist/lualib/ObjectValues.lua" ) ,
40
- Set : require ( "raw-loader!../../node_modules/typescript-to-lua/dist/lualib/Set.lua" ) ,
41
- WeakMap : require ( "raw-loader!../../node_modules/typescript-to-lua/dist/lualib/WeakMap.lua" ) ,
42
- WeakSet : require ( "raw-loader!../../node_modules/typescript-to-lua/dist/lualib/WeakSet.lua" ) ,
43
- SourceMapTraceBack : require ( "raw-loader!../../node_modules/typescript-to-lua/dist/lualib/SourceMapTraceBack.lua" ) ,
44
- StringReplace : require ( "raw-loader!../../node_modules/typescript-to-lua/dist/lualib/StringReplace.lua" ) ,
45
- StringSplit : require ( "raw-loader!../../node_modules/typescript-to-lua/dist/lualib/StringSplit.lua" ) ,
46
- StringConcat : require ( "raw-loader!../../node_modules/typescript-to-lua/dist/lualib/StringConcat.lua" ) ,
47
- Symbol : require ( "raw-loader!../../node_modules/typescript-to-lua/dist/lualib/Symbol.lua" ) ,
48
- SymbolRegistry : require ( "raw-loader!../../node_modules/typescript-to-lua/dist/lualib/SymbolRegistry.lua" ) ,
49
- }
50
-
51
6
declare var self : any ;
52
7
8
+ /** Dummy fs for lualib compatibility */
53
9
self . fs = {
54
10
readFileSync : ( fileName : string ) => {
55
11
let featureName = fileName . replace ( "/dist/lualib/" , "" ) . replace ( ".lua" , "" ) ;
56
- return new Buffer ( luaLib [ featureName ] ) ;
12
+ return new Buffer ( require ( `raw-loader!../../node_modules/typescript-to-lua/dist/lualib/ ${ featureName } .lua` ) ) ;
57
13
}
58
14
}
59
15
@@ -76,7 +32,6 @@ function transpileString(str: string, options: CompilerOptions = {
76
32
getNewLine : ( ) => '\n' ,
77
33
78
34
getSourceFile : ( filename : string , languageVersion : any ) => {
79
- console . log ( filename ) ;
80
35
if ( filename === 'file.ts' ) {
81
36
return ts . createSourceFile (
82
37
filename , str , ts . ScriptTarget . Latest , false ) ;
0 commit comments