forked from denoland/deno
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
deno2: compile in TS, build protobuf
- Loading branch information
Showing
7 changed files
with
529 additions
and
3,013 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
// Copyright 2018 Ryan Dahl <[email protected]> | ||
// All rights reserved. MIT License. | ||
type MessageCallback = (msg: ArrayBuffer) => void; | ||
declare function denoSub(channel: string, cb: MessageCallback): void; | ||
declare function denoPub(channel: string, msg: ArrayBuffer): null | ArrayBuffer; | ||
declare function denoPrint(x: string): void; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,13 @@ | ||
/// <reference path="deno.d.ts" /> | ||
//import { main as pb } from "deno_pb/msg.pb" | ||
import * as ts from "typescript"; | ||
|
||
const globalEval = eval; | ||
const window = globalEval("this"); | ||
window["denoMain"] = () => { | ||
//const msg = pb.Msg.fromObject({}); | ||
//denoPrint(`msg.command: ${msg.command}`); | ||
denoPrint(`ts.version: ${ts.version}`); | ||
denoPrint("Hello world from foo"); | ||
return "foo"; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
{ | ||
"devDependencies": { | ||
"parcel-bundler": "^1.8.1", | ||
"browserify": "^16.2.2", | ||
"protobufjs": "^6.8.6", | ||
"typescript": "^2.9.1" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,18 @@ | ||
#!/usr/bin/env python | ||
""" | ||
gn can only run python scripts. | ||
Also Node programs except to be run with cwd = $root_dir/js so it can resolve | ||
node_modules. | ||
""" | ||
import subprocess | ||
import sys | ||
import os | ||
|
||
|
||
js_path = os.path.dirname(os.path.realpath(__file__)) | ||
os.chdir(js_path) | ||
node_modules_path = os.path.join(js_path, "node_modules") | ||
|
||
# root_out_dir | ||
if not os.path.exists("node_modules"): | ||
os.symlink(node_modules_path, "node_modules") | ||
|
||
args = ["node"] + sys.argv[1:] | ||
sys.exit(subprocess.call(args)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"compilerOptions": { | ||
"allowJs": true, | ||
"module": "commonjs", | ||
"noImplicitAny": true, | ||
"sourceMap": true, | ||
"removeComments": true, | ||
"preserveConstEnums": true, | ||
"declaration": true, | ||
"target": "es2017", | ||
"noImplicitReturns": true, | ||
"pretty": true, | ||
"noFallthroughCasesInSwitch": true, | ||
"allowUnreachableCode": false, | ||
"experimentalDecorators": true | ||
}, | ||
"include": ["*.ts", "*.js"], | ||
"exclude": ["tests.ts"] | ||
} |
Oops, something went wrong.