Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
deno
提交
0715803b
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,体验更适合开发者的 AI 搜索 >>
未验证
提交
0715803b
编写于
9月 15, 2020
作者:
R
Ryan Dahl
提交者:
GitHub
9月 15, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Remove http_client from CliState, store in OpState directly (#7497)
上级
b2fa903d
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
11 addition
and
12 deletion
+11
-12
cli/ops/fetch.rs
cli/ops/fetch.rs
+5
-7
cli/state.rs
cli/state.rs
+0
-4
cli/worker.rs
cli/worker.rs
+6
-1
未找到文件。
cli/ops/fetch.rs
浏览文件 @
0715803b
...
...
@@ -51,9 +51,9 @@ async fn op_fetch(
.ok_or_else
(
bad_resource_id
)
?
;
r
.client
.clone
()
}
else
{
let
cli_state
=
super
::
cli_state2
(
&
state
);
let
client
_ref
=
cli_state
.http_client
.borrow
();
client
_ref
.clone
()
let
state_
=
state
.borrow
(
);
let
client
=
state_
.borrow
::
<
reqwest
::
Client
>
();
client
.clone
()
};
let
method
=
match
args
.method
{
...
...
@@ -103,14 +103,12 @@ async fn op_fetch(
))),
);
let
json_res
=
json!
({
Ok
(
json!
({
"bodyRid"
:
rid
,
"status"
:
status
.as_u16
(),
"statusText"
:
status
.canonical_reason
()
.unwrap_or
(
""
),
"headers"
:
res_headers
});
Ok
(
json_res
)
}))
}
struct
HttpClientResource
{
...
...
cli/state.rs
浏览文件 @
0715803b
...
...
@@ -3,7 +3,6 @@
use
crate
::
file_fetcher
::
SourceFileFetcher
;
use
crate
::
global_state
::
GlobalState
;
use
crate
::
global_timer
::
GlobalTimer
;
use
crate
::
http_util
::
create_http_client
;
use
crate
::
import_map
::
ImportMap
;
use
crate
::
metrics
::
Metrics
;
use
crate
::
permissions
::
Permissions
;
...
...
@@ -48,7 +47,6 @@ pub struct CliState {
pub
target_lib
:
TargetLib
,
pub
is_main
:
bool
,
pub
is_internal
:
bool
,
pub
http_client
:
RefCell
<
reqwest
::
Client
>
,
}
pub
fn
exit_unstable
(
api_name
:
&
str
)
{
...
...
@@ -180,7 +178,6 @@ impl CliState {
target_lib
:
TargetLib
::
Main
,
is_main
:
true
,
is_internal
,
http_client
:
create_http_client
(
fl
.ca_file
.as_deref
())
?
.into
(),
};
Ok
(
Rc
::
new
(
state
))
}
...
...
@@ -208,7 +205,6 @@ impl CliState {
target_lib
:
TargetLib
::
Worker
,
is_main
:
false
,
is_internal
:
false
,
http_client
:
create_http_client
(
fl
.ca_file
.as_deref
())
?
.into
(),
};
Ok
(
Rc
::
new
(
state
))
}
...
...
cli/worker.rs
浏览文件 @
0715803b
...
...
@@ -107,12 +107,13 @@ impl Worker {
state
:
&
Rc
<
CliState
>
,
)
->
Self
{
let
global_state
=
state
.global_state
.clone
();
let
global_state_
=
global_state
.clone
();
let
mut
isolate
=
JsRuntime
::
new
(
RuntimeOptions
{
module_loader
:
Some
(
state
.clone
()),
startup_snapshot
,
js_error_create_fn
:
Some
(
Box
::
new
(
move
|
core_js_error
|
{
JsError
::
create
(
core_js_error
,
&
global_state
.ts_compiler
)
JsError
::
create
(
core_js_error
,
&
global_state
_
.ts_compiler
)
})),
..
Default
::
default
()
});
...
...
@@ -121,6 +122,10 @@ impl Worker {
let
mut
op_state
=
op_state
.borrow_mut
();
op_state
.get_error_class_fn
=
&
crate
::
errors
::
get_error_class_name
;
op_state
.put
(
state
.clone
());
let
ca_file
=
global_state
.flags.ca_file
.as_deref
();
let
client
=
crate
::
http_util
::
create_http_client
(
ca_file
)
.unwrap
();
op_state
.put
(
client
);
}
let
inspector
=
{
let
global_state
=
&
state
.global_state
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录