Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
deno
提交
249db0f7
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,发现更多精彩内容 >>
提交
249db0f7
编写于
9月 04, 2019
作者:
Y
Yoshiya Hinosawa
提交者:
Ryan Dahl
9月 03, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Handle typescript version in rust (#2855)
上级
e9908453
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
29 addition
and
18 deletion
+29
-18
cli/main.rs
cli/main.rs
+7
-1
cli/ops/os.rs
cli/ops/os.rs
+1
-0
cli/version.rs
cli/version.rs
+11
-0
deno_typescript/compiler_main.js
deno_typescript/compiler_main.js
+0
-1
js/main.ts
js/main.ts
+1
-12
js/os.ts
js/os.ts
+1
-0
js/version.ts
js/version.ts
+8
-4
未找到文件。
cli/main.rs
浏览文件 @
249db0f7
...
...
@@ -398,6 +398,12 @@ fn run_script(flags: DenoFlags, argv: Vec<String>) {
}
}
fn
version_command
()
{
println!
(
"deno: {}"
,
version
::
DENO
);
println!
(
"v8: {}"
,
version
::
v8
());
println!
(
"typescript: {}"
,
version
::
typescript
());
}
fn
main
()
{
#[cfg(windows)]
ansi_term
::
enable_ansi_support
()
.ok
();
// For Windows 10
...
...
@@ -425,7 +431,7 @@ fn main() {
DenoSubcommand
::
Repl
=>
run_repl
(
flags
,
argv
),
DenoSubcommand
::
Run
=>
run_script
(
flags
,
argv
),
DenoSubcommand
::
Types
=>
types_command
(),
DenoSubcommand
::
Version
=>
run_repl
(
flags
,
argv
),
DenoSubcommand
::
Version
=>
version_command
(
),
DenoSubcommand
::
Xeval
=>
xeval_command
(
flags
,
argv
),
}
}
cli/ops/os.rs
浏览文件 @
249db0f7
...
...
@@ -28,6 +28,7 @@ pub fn op_start(
"versionFlag"
:
state
.flags.version
,
"v8Version"
:
version
::
v8
(),
"denoVersion"
:
version
::
DENO
,
"tsVersion"
:
version
::
typescript
(),
"noColor"
:
!
ansi
::
use_color
(),
"xevalDelim"
:
state
.flags.xeval_delim
.clone
(),
})))
...
...
cli/version.rs
浏览文件 @
249db0f7
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
use
serde_json
;
pub
const
DENO
:
&
str
=
env!
(
"CARGO_PKG_VERSION"
);
pub
fn
v8
()
->
&
'static
str
{
deno
::
v8_version
()
}
pub
fn
typescript
()
->
String
{
// TODO: By using include_str! we are including the package.json into
// the deno binary using serde to decode it at runtime. This is suboptimal
// in space and time. We need to extract the TypeScript version at compile
// time instead. This will be easier after #2608.
let
data
=
include_str!
(
"../node_modules/typescript/package.json"
);
let
pkg
:
serde_json
::
Value
=
serde_json
::
from_str
(
data
)
.unwrap
();
pkg
[
"version"
]
.as_str
()
.unwrap
()
.to_string
()
}
deno_typescript/compiler_main.js
浏览文件 @
249db0f7
...
...
@@ -10,7 +10,6 @@ function main(configText, rootNames, replacements_) {
println
(
`>>> rootNames
${
rootNames
}
`
);
replacements
=
replacements_
;
replacements
[
"
DENO_REPLACE_TS_VERSION
"
]
=
ts
.
version
;
println
(
`>>> replacements
${
JSON
.
stringify
(
replacements
)}
`
);
const
host
=
new
Host
();
...
...
js/main.ts
浏览文件 @
249db0f7
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
import
"
./globals.ts
"
;
import
{
assert
,
log
}
from
"
./util.ts
"
;
...
...
@@ -11,21 +10,11 @@ import { xevalMain, XevalFunc } from "./xeval.ts";
import
{
setVersions
}
from
"
./version.ts
"
;
import
{
window
}
from
"
./window.ts
"
;
import
{
setLocation
}
from
"
./location.ts
"
;
import
*
as
Deno
from
"
./deno.ts
"
;
function
denoMain
(
preserveDenoNamespace
:
boolean
=
true
,
name
?:
string
):
void
{
const
s
=
os
.
start
(
preserveDenoNamespace
,
name
);
setVersions
(
s
.
denoVersion
,
s
.
v8Version
);
// handle `--version`
if
(
s
.
versionFlag
)
{
const
{
console
}
=
window
;
console
.
log
(
"
deno:
"
,
Deno
.
version
.
deno
);
console
.
log
(
"
v8:
"
,
Deno
.
version
.
v8
);
console
.
log
(
"
typescript:
"
,
Deno
.
version
.
typescript
);
os
.
exit
(
0
);
}
setVersions
(
s
.
denoVersion
,
s
.
v8Version
,
s
.
tsVersion
);
setPrepareStackTrace
(
Error
);
...
...
js/os.ts
浏览文件 @
249db0f7
...
...
@@ -59,6 +59,7 @@ interface Start {
versionFlag
:
boolean
;
denoVersion
:
string
;
v8Version
:
string
;
tsVersion
:
string
;
noColor
:
boolean
;
xevalDelim
:
string
;
}
...
...
js/version.ts
浏览文件 @
249db0f7
...
...
@@ -8,17 +8,21 @@ interface Version {
export
const
version
:
Version
=
{
deno
:
""
,
v8
:
""
,
// This string will be replaced by rollup
typescript
:
`DENO_REPLACE_TS_VERSION`
typescript
:
""
};
/**
* Sets the deno
and v8
versions and freezes the version object.
* Sets the deno
, v8, and typescript
versions and freezes the version object.
* @internal
*/
export
function
setVersions
(
denoVersion
:
string
,
v8Version
:
string
):
void
{
export
function
setVersions
(
denoVersion
:
string
,
v8Version
:
string
,
tsVersion
:
string
):
void
{
version
.
deno
=
denoVersion
;
version
.
v8
=
v8Version
;
version
.
typescript
=
tsVersion
;
Object
.
freeze
(
version
);
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录