01alchemist / TurboScript

Super charged typed JavaScript dialect for parallel programming which compiles to WebAssembly
Apache License 2.0
494 stars 35 forks source link

Simplificate setup and compiling on browser side #107

Closed MaxGraey closed 7 years ago

MaxGraey commented 7 years ago

The main problem with existing code is high dependency of turboscript's library, systemjs and very complicated setup process:

loadLibrary(function (libs) {
  SystemJS.import("main").then(function (exports) {
       var compiledJavaScript = compileJavaScript(exports, libs);

       var sources = [{
         name: '<stdin>',
         contents: 'var a: int32 = 10;',
       }];

       var compiled = compiledJavaScript(sources, 'WebAssembly', 'compiled');
  }
}

But loadLibrary and compileJavaScript contains in common.js, so now we need load a lot of files: "system.js" , "common.js", "turbo.js", "array.tbs", "malloc.tbs", "types.tbs" and our init script.

My propositions:

1. Make one solid bundle file via webpack or tsc/browserify/gulp/uglifyJS 2. Implement simple method compileString(input: string, target: string, exports: [])

nidin commented 7 years ago

I am redesiging most of the parts this is one of it