-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
50 lines (46 loc) · 1.08 KB
/
Copy pathmain.go
File metadata and controls
50 lines (46 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package main
import (
bundler2 "github.com/FruitSpace/GhostCore.Modules/_old/bundler"
"github.com/FruitSpace/GhostCore.Modules/_old/engine"
esbuild "github.com/evanw/esbuild/pkg/api"
"log"
"os"
)
var scripts = []string{
"test_function.js",
"test_anonymous.js",
"test_modules_compiled.js",
//"test_math.js",
}
var testF = map[string]interface{}{
"fNumber": 40,
"fString": "Hello",
"fObject": struct {
Data string
}{"This is object data"},
"fFunction": "deferred value yay",
}
func main() {
fname := os.Args[1]
data, err := bundler2.AutoFolder(fname)
if err != nil {
log.Panicln(err)
}
log.Printf("Bundling '%s' (ver.%s) by %s", data.Script, data.Version, data.Author)
nb := bundler2.NewBundler().WithEntryPoint(data.Entrypoint).UseMinify(true).
WithOutfile("script.js", false).WithLogLevel(esbuild.LogLevelInfo)
code, err := nb.Bundle()
if err != nil {
log.Println(err)
log.Println(nb.GetErrors())
return
}
log.Println("Running in VM...")
e := engine.NewEngine(false)
err = e.LoadString(string(code.Contents))
if err != nil {
log.Panicln(err)
}
for {
}
}