Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
deno
提交
d2665537
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,发现更多精彩内容 >>
提交
d2665537
编写于
2月 12, 2019
作者:
Y
Yoshiya Hinosawa
提交者:
Ryan Dahl
2月 11, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: improve formatting (#1732)
上级
90c7af27
变更
17
隐藏空白更改
内联
并排
Showing
17 changed file
with
55 addition
and
30 deletion
+55
-30
.appveyor.yml
.appveyor.yml
+1
-0
.github/CONTRIBUTING.md
.github/CONTRIBUTING.md
+2
-1
.travis.yml
.travis.yml
+1
-0
Docs.md
Docs.md
+2
-1
js/console_test.ts
js/console_test.ts
+5
-2
js/repl.ts
js/repl.ts
+2
-1
tools/benchmark.py
tools/benchmark.py
+14
-9
tools/fmt_test.py
tools/fmt_test.py
+1
-2
tools/format.ts
tools/format.ts
+12
-3
tools/integration_tests.py
tools/integration_tests.py
+4
-3
tools/is_tty_test.py
tools/is_tty_test.py
+3
-0
tools/lint.py
tools/lint.py
+2
-2
tools/permission_prompt_test.ts
tools/permission_prompt_test.ts
+2
-2
tools/test.py
tools/test.py
+0
-1
tools/third_party.py
tools/third_party.py
+1
-2
tools/unit_tests.py
tools/unit_tests.py
+2
-1
tools/util.py
tools/util.py
+1
-0
未找到文件。
.appveyor.yml
浏览文件 @
d2665537
...
...
@@ -18,6 +18,7 @@ environment:
RUSTUP_HOME
:
$(RUST_DIR)\rustup
RUST_BACKTRACE
:
full
RUSTC_WRAPPER
:
sccache
PYTHONPATH
:
third_party\python_packages
SCCACHE_BUCKET
:
deno-sccache
AWS_ACCESS_KEY_ID
:
AKIAIVRN52PLDBP55LBQ
AWS_SECRET_ACCESS_KEY
:
...
...
.github/CONTRIBUTING.md
浏览文件 @
d2665537
...
...
@@ -19,7 +19,8 @@ Before submitting, please make sure the following is done:
1.
There are tests that cover the changes.
2.
Ensure
`./tools/test.py`
passes.
3.
Format your code with
`deno ./tools/format.ts --allow-read --allow-run`
.
3.
Format your code with
`PYTHONPATH=third_party/python_packages deno ./tools/format.ts --allow-read --allow-run`
.
<!-- TODO: set PYTHONPATH in format.ts when run API has env option -->
4.
Make sure
`./tools/lint.py`
passes.
## Changes to `third_party`
...
...
.travis.yml
浏览文件 @
d2665537
...
...
@@ -10,6 +10,7 @@ env:
-
RUST_BACKTRACE=full
-
CARGO_TARGET_DIR=$HOME/target
-
PATH=$TRAVIS_BUILD_DIR/third_party/llvm-build/Release+Asserts/bin:$CARGO_HOME/bin:$PATH
-
PYTHONPATH=third_party/python_packages
-
RUSTC_WRAPPER=sccache
-
SCCACHE_BUCKET=deno-sccache
-
AWS_ACCESS_KEY_ID=AKIAIVRN52PLDBP55LBQ
...
...
Docs.md
浏览文件 @
d2665537
...
...
@@ -116,7 +116,8 @@ Extra steps for Windows users:
./tools/test.py
# Format code.
deno ./tools/format.ts --allow-read --allow-run
PYTHONPATH=third_party/python_packages deno ./tools/format.ts --allow-read --allow-run
<!-- TODO: set PYTHONPATH in format.ts when run API has env option -->
Other useful commands:
...
...
js/console_test.ts
浏览文件 @
d2665537
...
...
@@ -245,8 +245,11 @@ test(function consoleTestError() {
try
{
throw
new
MyError
(
"
This is an error
"
);
}
catch
(
e
)
{
assert
(
stringify
(
e
).
split
(
"
\n
"
)[
3
]
.
includes
(
"
MyError: This is an error
"
));
assert
(
stringify
(
e
)
.
split
(
"
\n
"
)[
3
]
.
includes
(
"
MyError: This is an error
"
)
);
}
});
...
...
js/repl.ts
浏览文件 @
d2665537
...
...
@@ -107,7 +107,8 @@ function evaluate(code: string): void {
}
else
{
if
(
errInfo
.
isNativeError
)
{
const
formattedError
=
formatError
(
libdeno
.
errorToJSON
(
errInfo
.
thrown
as
Error
));
libdeno
.
errorToJSON
(
errInfo
.
thrown
as
Error
)
);
console
.
error
(
formattedError
);
}
else
{
console
.
error
(
"
Thrown:
"
,
errInfo
.
thrown
);
...
...
tools/benchmark.py
浏览文件 @
d2665537
...
...
@@ -57,15 +57,20 @@ def import_data_from_gh_pages():
def
get_binary_sizes
(
build_dir
):
path_dict
=
{
"deno"
:
os
.
path
.
join
(
build_dir
,
"deno"
+
executable_suffix
),
"main.js"
:
os
.
path
.
join
(
build_dir
,
"gen/bundle/main.js"
),
"main.js.map"
:
os
.
path
.
join
(
build_dir
,
"gen/bundle/main.js.map"
),
"compiler.js"
:
os
.
path
.
join
(
build_dir
,
"gen/bundle/compiler.js"
),
"compiler.js.map"
:
os
.
path
.
join
(
build_dir
,
"gen/bundle/compiler.js.map"
),
"snapshot_deno.bin"
:
os
.
path
.
join
(
build_dir
,
"gen/snapshot_deno.bin"
),
"snapshot_compiler.bin"
:
os
.
path
.
join
(
build_dir
,
"gen/snapshot_compiler.bin"
)
"deno"
:
os
.
path
.
join
(
build_dir
,
"deno"
+
executable_suffix
),
"main.js"
:
os
.
path
.
join
(
build_dir
,
"gen/bundle/main.js"
),
"main.js.map"
:
os
.
path
.
join
(
build_dir
,
"gen/bundle/main.js.map"
),
"compiler.js"
:
os
.
path
.
join
(
build_dir
,
"gen/bundle/compiler.js"
),
"compiler.js.map"
:
os
.
path
.
join
(
build_dir
,
"gen/bundle/compiler.js.map"
),
"snapshot_deno.bin"
:
os
.
path
.
join
(
build_dir
,
"gen/snapshot_deno.bin"
),
"snapshot_compiler.bin"
:
os
.
path
.
join
(
build_dir
,
"gen/snapshot_compiler.bin"
)
}
sizes
=
{}
for
name
,
path
in
path_dict
.
items
():
...
...
tools/fmt_test.py
浏览文件 @
d2665537
...
...
@@ -18,8 +18,7 @@ def fmt_test(deno_exe):
# Set DENO_DIR to //js/ so we don't have to rely on an intenet
# connection to download https://deno.land/x/std/prettier/main.ts
deno_dir
=
os
.
path
.
join
(
root_path
,
"js"
)
run
(
[
deno_exe
,
dst
,
"--fmt"
,
"--allow-read"
],
run
([
deno_exe
,
dst
,
"--fmt"
,
"--allow-read"
],
merge_env
=
{
"DENO_DIR"
:
deno_dir
})
with
open
(
fixed_filename
)
as
f
:
expected
=
f
.
read
()
...
...
tools/format.ts
浏览文件 @
d2665537
...
...
@@ -10,12 +10,20 @@ const yapf = join("third_party", "python_packages", "bin", "yapf");
const
rustfmt
=
join
(
"
third_party
"
,
"
rustfmt
"
,
deno
.
platform
.
os
,
"
rustfmt
"
);
const
rustfmtConfig
=
"
.rustfmt.toml
"
;
const
run
=
(...
args
:
string
[])
=>
{
const
decoder
=
new
TextDecoder
();
async
function
run
(...
args
:
string
[]):
Promise
<
void
>
{
if
(
deno
.
platform
.
os
===
"
win
"
)
{
args
=
[
"
cmd.exe
"
,
"
/c
"
,
...
args
];
}
return
deno
.
run
({
args
,
stdout
:
"
null
"
,
stderr
:
"
piped
"
}).
status
();
};
const
p
=
deno
.
run
({
args
,
stdout
:
"
piped
"
,
stderr
:
"
piped
"
});
const
{
code
}
=
await
p
.
status
();
if
(
code
!==
0
)
{
console
.
log
(
decoder
.
decode
(
await
deno
.
readAll
(
p
.
stderr
)));
console
.
log
(
decoder
.
decode
(
await
deno
.
readAll
(
p
.
stdout
)));
deno
.
exit
(
code
);
}
}
(
async
()
=>
{
console
.
log
(
"
clang_format
"
);
...
...
@@ -49,6 +57,7 @@ const run = (...args: string[]) => {
console
.
log
(
"
prettier
"
);
await
run
(
lookupDenoPath
(),
"
--allow-read
"
,
"
--allow-write
"
,
"
js/deps/https/deno.land/x/std/prettier/main.ts
"
,
"
rollup.config.js
"
,
...
...
tools/integration_tests.py
浏览文件 @
d2665537
...
...
@@ -45,7 +45,7 @@ def str2bool(v):
raise
ValueError
(
"Bad boolean value"
)
def
integration_tests
(
deno_exe
,
test_filter
=
None
):
def
integration_tests
(
deno_exe
,
test_filter
=
None
):
assert
os
.
path
.
isfile
(
deno_exe
)
tests
=
sorted
([
filename
for
filename
in
os
.
listdir
(
tests_path
)
...
...
@@ -97,11 +97,12 @@ def integration_tests(deno_exe, test_filter = None):
print
green_ok
()
def
main
():
parser
=
argparse
.
ArgumentParser
()
parser
.
add_argument
(
"--filter"
,
help
=
"Run specific tests"
)
parser
.
add_argument
(
"--release"
,
help
=
"Use release build of Deno"
,
action
=
"store_true"
)
parser
.
add_argument
(
"--release"
,
help
=
"Use release build of Deno"
,
action
=
"store_true"
)
parser
.
add_argument
(
"--executable"
,
help
=
"Use external executable of Deno"
)
args
=
parser
.
parse_args
()
...
...
tools/is_tty_test.py
浏览文件 @
d2665537
...
...
@@ -10,15 +10,18 @@ from permission_prompt_test import tty_capture
IS_TTY_TEST_TS
=
"tests/is_tty.ts"
def
is_tty_test
(
deno_exe
):
cmd
=
[
deno_exe
,
IS_TTY_TEST_TS
]
code
,
stdout
,
_
=
tty_capture
(
cmd
,
b
''
)
assert
code
==
0
assert
str
(
stdin
.
isatty
()).
lower
()
in
stdout
def
main
():
deno_exe
=
os
.
path
.
join
(
build_path
(),
"deno"
+
executable_suffix
)
is_tty_test
(
deno_exe
)
if
__name__
==
"__main__"
:
main
()
tools/lint.py
浏览文件 @
d2665537
...
...
@@ -15,8 +15,8 @@ tslint = os.path.join(third_party_path, "node_modules", "tslint", "bin",
os
.
chdir
(
root_path
)
run
([
"python"
,
cpplint
,
"--filter=-build/include_subdir"
,
"--repository=libdeno"
,
"--extensions=cc,h"
,
"--recursive"
,
"libdeno"
"python"
,
cpplint
,
"--filter=-build/include_subdir"
,
"--
repository=libdeno"
,
"--
extensions=cc,h"
,
"--recursive"
,
"libdeno"
])
run
([
"node"
,
tslint
,
"-p"
,
"."
,
"--exclude"
,
"**/gen/**/*.ts"
])
...
...
tools/permission_prompt_test.ts
浏览文件 @
d2665537
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
import
{
args
,
listen
,
env
,
exit
,
makeTempDirSync
,
readFile
,
run
}
from
"
deno
"
;
import
{
args
,
listen
,
env
,
exit
,
makeTempDirSync
,
readFile
,
run
}
from
"
deno
"
;
const
name
=
args
[
1
];
const
test
=
{
needsRead
:
()
=>
{
readFile
(
"
package.json
"
)
readFile
(
"
package.json
"
)
;
},
needsWrite
:
()
=>
{
makeTempDirSync
();
...
...
tools/test.py
浏览文件 @
d2665537
...
...
@@ -38,7 +38,6 @@ def test_no_color(deno_exe):
print
green_ok
()
def
main
(
argv
):
if
len
(
argv
)
==
2
:
build_dir
=
sys
.
argv
[
1
]
...
...
tools/third_party.py
浏览文件 @
d2665537
...
...
@@ -255,8 +255,7 @@ def download_clang_format():
# Download clang by calling the clang update script.
def
download_clang
():
run
([
'python'
,
tp
(
'v8/tools/clang/scripts/update.py'
)],
env
=
google_env
())
run
([
'python'
,
tp
(
'v8/tools/clang/scripts/update.py'
)],
env
=
google_env
())
def
maybe_download_sysroot
():
...
...
tools/unit_tests.py
浏览文件 @
d2665537
...
...
@@ -46,7 +46,8 @@ def unit_tests(deno_exe):
run_unit_test
(
deno_exe
,
"permR0W0N0E0U0"
)
run_unit_test
(
deno_exe
,
"permR1W0N0E0U0"
,
[
"--allow-read"
])
run_unit_test
(
deno_exe
,
"permR0W1N0E0U0"
,
[
"--allow-write"
])
run_unit_test
(
deno_exe
,
"permR1W1N0E0U0"
,
[
"--allow-read"
,
"--allow-write"
])
run_unit_test
(
deno_exe
,
"permR1W1N0E0U0"
,
[
"--allow-read"
,
"--allow-write"
])
run_unit_test
(
deno_exe
,
"permR1W0N1E0U0"
,
[
"--allow-read"
,
"--allow-net"
])
run_unit_test
(
deno_exe
,
"permR0W0N0E1U0"
,
[
"--allow-env"
])
run_unit_test
(
deno_exe
,
"permR0W0N0E0U1"
,
[
"--allow-run"
])
...
...
tools/util.py
浏览文件 @
d2665537
...
...
@@ -383,6 +383,7 @@ def parse_wrk_output(output):
def
platform
():
return
{
"linux2"
:
"linux"
,
"darwin"
:
"mac"
,
"win32"
:
"win"
}[
sys
.
platform
]
def
mkdtemp
():
# On Windows, set the base directory that mkdtemp() uses explicitly. If not,
# it'll use the short (8.3) path to the temp dir, which triggers the error
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录