Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
deno
提交
b3003535
D
deno
项目概览
张重言
/
deno
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
deno
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
b3003535
编写于
6月 12, 2018
作者:
R
Ryan Dahl
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
deno2: compile in TS, build protobuf
上级
356fd18c
变更
7
展开全部
隐藏空白更改
内联
并排
Showing
7 changed file
with
529 addition
and
3013 deletion
+529
-3013
deno2/BUILD.gn
deno2/BUILD.gn
+80
-18
deno2/js/deno.d.ts
deno2/js/deno.d.ts
+6
-0
deno2/js/main.ts
deno2/js/main.ts
+7
-0
deno2/js/package.json
deno2/js/package.json
+2
-1
deno2/js/run_node.py
deno2/js/run_node.py
+7
-3
deno2/js/tsconfig.json
deno2/js/tsconfig.json
+19
-0
deno2/js/yarn.lock
deno2/js/yarn.lock
+408
-2991
未找到文件。
deno2/BUILD.gn
浏览文件 @
b3003535
...
...
@@ -68,29 +68,91 @@ proto_library("msg_proto") {
]
}
action("run_parcel") {
template("run_node") {
action(target_name) {
forward_variables_from(invoker, "*")
script = "js/run_node.py"
}
}
run_node("bundle") {
main_source = "$target_gen_dir/tsc_dist/main.js"
main_output = "$target_gen_dir/bundle/main.js"
sources = [
"js/main.ts"
,
main_source
,
]
outputs = [
"$target_gen_dir/main.js",
"$target_gen_dir/main.map",
main_output,
]
deps = [
":run_tsc",
]
args = [
"./node_modules/.bin/browserify",
rebase_path(main_source, root_build_dir),
"-o",
rebase_path(main_output, root_build_dir),
]
}
# Our script imports this Python file so we want to rebuild if it changes.
# inputs = [ "helper_library.py" ]
run_node("run_tsc") {
main_source = "js/main.ts"
sources = [
"$target_gen_dir/node_modules/deno_pb/msg.pb.d.ts",
"$target_gen_dir/node_modules/deno_pb/msg.pb.js",
"js/tsconfig.json",
main_source,
]
out_dir = "$target_gen_dir/tsc_dist"
outputs = [
out_dir + "/main.js",
out_dir + "/main.map",
]
deps = [
":run_pbjs",
":run_pbts",
]
args = [
"./node_modules/.bin/tsc",
"--baseUrl",
rebase_path(target_gen_dir + "/node_modules", root_build_dir),
"--outDir",
rebase_path(out_dir, root_build_dir),
rebase_path(main_source, root_build_dir),
]
}
# Note that we have to manually pass the sources to our script if the
# script needs them as inputs.
script = "js/run_node.py"
root = root_build_dir + "/../../js"
run_node("run_pbjs") {
sources = [
"msg.proto",
]
outputs = [
"$target_gen_dir/node_modules/deno_pb/msg.pb.js",
]
args = [
"./node_modules/.bin/pbjs",
"--target=static-module",
"--wraper=commonjs",
"--out=" + rebase_path(outputs[0], root_build_dir),
rebase_path(sources[0], root_build_dir),
]
}
run_node("run_pbts") {
sources = [
"$target_gen_dir/node_modules/deno_pb/msg.pb.js",
]
outputs = [
"$target_gen_dir/node_modules/deno_pb/msg.pb.d.ts",
]
args = [
"./node_modules/.bin/parcel",
"build",
"--log-level=1",
"--no-minify",
"--out-dir=" + rebase_path(target_gen_dir, root),
] + rebase_path(sources, root)
"./node_modules/.bin/pbts",
"--out=" + rebase_path(outputs[0], root_build_dir),
rebase_path(sources[0], root_build_dir),
]
deps = [
":run_pbjs",
]
}
# Template to generate different V8 snapshots based on different runtime flags.
...
...
@@ -145,9 +207,9 @@ template("create_snapshot") {
# Generates $target_gen_dir/snapshot_deno.cc
create_snapshot("deno") {
js = "$target_gen_dir/main.js"
js = "$target_gen_dir/
bundle/
main.js"
deps = [
":
run_parcel
",
":
bundle
",
]
}
...
...
deno2/js/deno.d.ts
0 → 100644
浏览文件 @
b3003535
// Copyright 2018 Ryan Dahl <ry@tinyclouds.org>
// 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
;
deno2/js/main.ts
浏览文件 @
b3003535
/// <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
"
;
};
deno2/js/package.json
浏览文件 @
b3003535
{
"devDependencies"
:
{
"parcel-bundler"
:
"^1.8.1"
,
"browserify"
:
"^16.2.2"
,
"protobufjs"
:
"^6.8.6"
,
"typescript"
:
"^2.9.1"
}
}
deno2/js/run_node.py
浏览文件 @
b3003535
#!/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
))
deno2/js/tsconfig.json
0 → 100644
浏览文件 @
b3003535
{
"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"
]
}
deno2/js/yarn.lock
浏览文件 @
b3003535
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录