summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--main.go31
-rw-r--r--main.ts4
-rw-r--r--package.json8
-rw-r--r--tsconfig.json23
4 files changed, 66 insertions, 0 deletions
diff --git a/main.go b/main.go
new file mode 100644
index 000000000..b3a3e8874
--- /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 000000000..8fc83ea82
--- /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 000000000..df9a68f7e
--- /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 000000000..aa81406c3
--- /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"]
+}