From f7c5e19081920f59ce2006d3255a58fb611b6a17 Mon Sep 17 00:00:00 2001 From: Ryan Dahl Date: Sun, 13 May 2018 23:32:01 -0400 Subject: [PATCH] Init --- main.go | 31 +++++++++++++++++++++++++++++++ main.ts | 4 ++++ package.json | 8 ++++++++ tsconfig.json | 23 +++++++++++++++++++++++ 4 files changed, 66 insertions(+) create mode 100644 main.go create mode 100644 main.ts create mode 100644 package.json create mode 100644 tsconfig.json diff --git a/main.go b/main.go new file mode 100644 index 0000000000..b3a3e8874d --- /dev/null +++ b/main.go @@ -0,0 +1,31 @@ +// To test: make && ./out/render test_input.js +package main + +//go:generate go-bindata -pkg $GOPACKAGE -o assets.go dist/ + +import ( + "github.com/ry/v8worker2" +) + +func recv(msg []byte) []byte { + println("recv cb", string(msg)) + return nil +} + +func main() { + indexFn := "dist/main.js" + data, err := Asset(indexFn) + if err != nil { + panic("asset not found") + } + code := string(data) + + worker := v8worker2.New(recv) + + // Load up index.js code. + err = worker.Load(indexFn, code) + if err != nil { + println("Problem executing Javascript.") + panic(err) + } +} diff --git a/main.ts b/main.ts new file mode 100644 index 0000000000..8fc83ea828 --- /dev/null +++ b/main.ts @@ -0,0 +1,4 @@ +import * as ts from "typescript"; + + +V8Worker2.print("Hello World", ts.createProgram); diff --git a/package.json b/package.json new file mode 100644 index 0000000000..df9a68f7e7 --- /dev/null +++ b/package.json @@ -0,0 +1,8 @@ +{ + "name": "deno", + "dependencies": {}, + "devDependencies": { + "parcel-bundler": "^1.8.1", + "typescript": "^2.8.3" + } +} diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000000..aa81406c3f --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "noImplicitAny": true, + "sourceMap": true, + "removeComments": true, + "preserveConstEnums": true, + "declaration": true, + "target": "es5", + "lib": ["es2015", "dom"], + "noEmit": true, + "noUnusedLocals": true, + "noImplicitReturns": true, + "noImplicitThis": true, + "alwaysStrict": true, + "noUnusedParameters": false, + "pretty": true, + "noFallthroughCasesInSwitch": true, + "allowUnreachableCode": false, + "experimentalDecorators": true + }, + "include": ["*.ts"] +}