Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
deno
提交
5e2fd183
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,发现更多精彩内容 >>
未验证
提交
5e2fd183
编写于
1月 21, 2020
作者:
B
Bartek Iwańczuk
提交者:
GitHub
1月 21, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refactor: Rename JS entry functions (#3732)
上级
0cd60551
变更
12
隐藏空白更改
内联
并排
Showing
12 changed file
with
58 addition
and
56 deletion
+58
-56
cli/compilers/ts.rs
cli/compilers/ts.rs
+3
-3
cli/compilers/wasm.rs
cli/compilers/wasm.rs
+3
-3
cli/js.rs
cli/js.rs
+1
-1
cli/js/compiler.ts
cli/js/compiler.ts
+14
-8
cli/js/globals.ts
cli/js/globals.ts
+6
-5
cli/js/lib.deno_runtime.d.ts
cli/js/lib.deno_runtime.d.ts
+3
-3
cli/js/main.ts
cli/js/main.ts
+3
-3
cli/js/os.ts
cli/js/os.ts
+10
-6
cli/js/worker_main.ts
cli/js/worker_main.ts
+5
-14
cli/lib.rs
cli/lib.rs
+5
-5
cli/ops/worker_host.rs
cli/ops/worker_host.rs
+2
-2
cli/worker.rs
cli/worker.rs
+3
-3
未找到文件。
cli/compilers/ts.rs
浏览文件 @
5e2fd183
...
@@ -246,9 +246,9 @@ impl TsCompiler {
...
@@ -246,9 +246,9 @@ impl TsCompiler {
worker_state
,
worker_state
,
ext
,
ext
,
);
);
worker
.execute
(
"
denoMain(
)"
)
.unwrap
();
worker
.execute
(
"
bootstrapCompilerRuntime('TS'
)"
)
.unwrap
();
worker
.execute
(
"
workerMain
()"
)
.unwrap
();
worker
.execute
(
"
bootstrapWorkerRuntime
()"
)
.unwrap
();
worker
.execute
(
"
compilerMain
()"
)
.unwrap
();
worker
.execute
(
"
bootstrapTsCompiler
()"
)
.unwrap
();
worker
worker
}
}
...
...
cli/compilers/wasm.rs
浏览文件 @
5e2fd183
...
@@ -60,9 +60,9 @@ impl WasmCompiler {
...
@@ -60,9 +60,9 @@ impl WasmCompiler {
worker_state
,
worker_state
,
ext
,
ext
,
);
);
worker
.execute
(
"
denoMain
('WASM')"
)
.unwrap
();
worker
.execute
(
"
bootstrapCompilerRuntime
('WASM')"
)
.unwrap
();
worker
.execute
(
"
workerMain
()"
)
.unwrap
();
worker
.execute
(
"
bootstrapWorkerRuntime
()"
)
.unwrap
();
worker
.execute
(
"
wasmCompilerMain
()"
)
.unwrap
();
worker
.execute
(
"
bootstrapWasmCompiler
()"
)
.unwrap
();
worker
worker
}
}
...
...
cli/js.rs
浏览文件 @
5e2fd183
...
@@ -42,7 +42,7 @@ fn compiler_snapshot() {
...
@@ -42,7 +42,7 @@ fn compiler_snapshot() {
deno_core
::
js_check
(
isolate
.execute
(
deno_core
::
js_check
(
isolate
.execute
(
"<anon>"
,
"<anon>"
,
r#"
r#"
if (!
compilerMain
) {
if (!
bootstrapTsCompiler
) {
throw Error("bad");
throw Error("bad");
}
}
console.log(`ts version: ${ts.version}`);
console.log(`ts version: ${ts.version}`);
...
...
cli/js/compiler.ts
浏览文件 @
5e2fd183
...
@@ -32,7 +32,11 @@ import { fromTypeScriptDiagnostic } from "./diagnostics_util.ts";
...
@@ -32,7 +32,11 @@ import { fromTypeScriptDiagnostic } from "./diagnostics_util.ts";
import
*
as
os
from
"
./os.ts
"
;
import
*
as
os
from
"
./os.ts
"
;
import
{
assert
}
from
"
./util.ts
"
;
import
{
assert
}
from
"
./util.ts
"
;
import
*
as
util
from
"
./util.ts
"
;
import
*
as
util
from
"
./util.ts
"
;
import
{
postMessage
,
workerClose
,
workerMain
}
from
"
./worker_main.ts
"
;
import
{
postMessage
,
workerClose
,
bootstrapWorkerRuntime
}
from
"
./worker_main.ts
"
;
const
self
=
globalThis
;
const
self
=
globalThis
;
...
@@ -74,17 +78,19 @@ interface CompileResult {
...
@@ -74,17 +78,19 @@ interface CompileResult {
}
}
// bootstrap the runtime environment, this gets called as the isolate is setup
// bootstrap the runtime environment, this gets called as the isolate is setup
self
.
denoMain
=
function
denoMain
(
compilerType
?:
string
):
void
{
self
.
bootstrapCompilerRuntime
=
function
bootstrapCompilerRuntime
(
os
.
start
(
true
,
compilerType
??
"
TS
"
);
compilerType
:
string
):
void
{
os
.
start
(
true
,
compilerType
);
};
};
// bootstrap the worker environment, this gets called as the isolate is setup
// bootstrap the worker environment, this gets called as the isolate is setup
self
.
workerMain
=
workerMain
;
self
.
bootstrapWorkerRuntime
=
bootstrapWorkerRuntime
;
// provide the "main" function that will be called by the privileged side when
// provide the "main" function that will be called by the privileged side when
// lazy instantiating the compiler web worker
// lazy instantiating the compiler web worker
self
.
compilerMain
=
function
c
ompilerMain
():
void
{
self
.
bootstrapTsCompiler
=
function
tsC
ompilerMain
():
void
{
//
workerMain
should have already been called since a compiler is a worker.
//
bootstrapWorkerRuntime
should have already been called since a compiler is a worker.
self
.
onmessage
=
async
({
self
.
onmessage
=
async
({
data
:
request
data
:
request
}:
{
}:
{
...
@@ -297,8 +303,8 @@ self.compilerMain = function compilerMain(): void {
...
@@ -297,8 +303,8 @@ self.compilerMain = function compilerMain(): void {
};
};
};
};
self
.
wasmCompilerMain
=
function
wasmCompilerMain
():
void
{
self
.
bootstrapWasmCompiler
=
function
wasmCompilerMain
():
void
{
//
workerMain
should have already been called since a compiler is a worker.
//
bootstrapWorkerRuntime
should have already been called since a compiler is a worker.
self
.
onmessage
=
async
({
self
.
onmessage
=
async
({
data
:
binary
data
:
binary
}:
{
}:
{
...
...
cli/js/globals.ts
浏览文件 @
5e2fd183
...
@@ -111,12 +111,13 @@ declare global {
...
@@ -111,12 +111,13 @@ declare global {
callback
:
(
event
:
domTypes
.
Event
)
=>
void
|
null
,
callback
:
(
event
:
domTypes
.
Event
)
=>
void
|
null
,
options
?:
boolean
|
domTypes
.
AddEventListenerOptions
|
undefined
options
?:
boolean
|
domTypes
.
AddEventListenerOptions
|
undefined
)
=>
void
;
)
=>
void
;
var
compilerMain
:
(()
=>
void
)
|
undefined
;
var
bootstrapTsCompiler
:
(()
=>
void
)
|
undefined
;
var
console
:
consoleTypes
.
Console
;
var
console
:
consoleTypes
.
Console
;
var
Deno
:
{
var
Deno
:
{
core
:
DenoCore
;
core
:
DenoCore
;
};
};
var
denoMain
:
(()
=>
void
)
|
undefined
;
var
bootstrapCompilerRuntime
:
((
compilerType
:
string
)
=>
void
)
|
undefined
;
var
bootstrapMainRuntime
:
(()
=>
void
)
|
undefined
;
var
location
:
domTypes
.
Location
;
var
location
:
domTypes
.
Location
;
var
onerror
:
var
onerror
:
|
((
|
((
...
@@ -132,8 +133,8 @@ declare global {
...
@@ -132,8 +133,8 @@ declare global {
var
onmessage
:
((
e
:
{
data
:
any
})
=>
Promise
<
void
>
|
void
)
|
undefined
;
var
onmessage
:
((
e
:
{
data
:
any
})
=>
Promise
<
void
>
|
void
)
|
undefined
;
var
onunload
:
((
e
:
domTypes
.
Event
)
=>
void
)
|
undefined
;
var
onunload
:
((
e
:
domTypes
.
Event
)
=>
void
)
|
undefined
;
var
queueMicrotask
:
(
callback
:
()
=>
void
)
=>
void
;
var
queueMicrotask
:
(
callback
:
()
=>
void
)
=>
void
;
var
wasmCompilerMain
:
(()
=>
void
)
|
undefined
;
var
bootstrapWasmCompiler
:
(()
=>
void
)
|
undefined
;
var
workerMain
:
(()
=>
Promise
<
void
>
|
void
)
|
undefined
;
var
bootstrapWorkerRuntime
:
(()
=>
Promise
<
void
>
|
void
)
|
undefined
;
/* eslint-enable */
/* eslint-enable */
}
}
...
@@ -198,7 +199,7 @@ const globalProperties = {
...
@@ -198,7 +199,7 @@ const globalProperties = {
onmessage
:
writable
(
workerRuntime
.
onmessage
),
onmessage
:
writable
(
workerRuntime
.
onmessage
),
onerror
:
writable
(
workerRuntime
.
onerror
),
onerror
:
writable
(
workerRuntime
.
onerror
),
workerMain
:
nonEnumerable
(
workerRuntime
.
workerMain
),
bootstrapWorkerRuntime
:
nonEnumerable
(
workerRuntime
.
bootstrapWorkerRuntime
),
workerClose
:
nonEnumerable
(
workerRuntime
.
workerClose
),
workerClose
:
nonEnumerable
(
workerRuntime
.
workerClose
),
postMessage
:
writable
(
workerRuntime
.
postMessage
),
postMessage
:
writable
(
workerRuntime
.
postMessage
),
Worker
:
nonEnumerable
(
workers
.
WorkerImpl
),
Worker
:
nonEnumerable
(
workers
.
WorkerImpl
),
...
...
cli/js/lib.deno_runtime.d.ts
浏览文件 @
5e2fd183
...
@@ -2175,7 +2175,7 @@ declare interface Window {
...
@@ -2175,7 +2175,7 @@ declare interface Window {
performance
:
__performanceUtil
.
Performance
;
performance
:
__performanceUtil
.
Performance
;
onmessage
:
(
e
:
{
data
:
any
})
=>
void
;
onmessage
:
(
e
:
{
data
:
any
})
=>
void
;
onerror
:
undefined
|
typeof
onerror
;
onerror
:
undefined
|
typeof
onerror
;
workerMain
:
typeof
__workerMain
.
workerMain
;
bootstrapWorkerRuntime
:
typeof
__workerMain
.
bootstrapWorkerRuntime
;
workerClose
:
typeof
__workerMain
.
workerClose
;
workerClose
:
typeof
__workerMain
.
workerClose
;
postMessage
:
typeof
__workerMain
.
postMessage
;
postMessage
:
typeof
__workerMain
.
postMessage
;
Worker
:
typeof
__workers
.
WorkerImpl
;
Worker
:
typeof
__workers
.
WorkerImpl
;
...
@@ -2234,7 +2234,7 @@ declare let onerror:
...
@@ -2234,7 +2234,7 @@ declare let onerror:
e
:
Event
e
:
Event
)
=>
boolean
|
void
)
)
=>
boolean
|
void
)
|
undefined
;
|
undefined
;
declare
const
workerMain
:
typeof
__workerMain
.
workerMain
;
declare
const
bootstrapWorkerRuntime
:
typeof
__workerMain
.
bootstrapWorkerRuntime
;
declare
const
workerClose
:
typeof
__workerMain
.
workerClose
;
declare
const
workerClose
:
typeof
__workerMain
.
workerClose
;
declare
const
postMessage
:
typeof
__workerMain
.
postMessage
;
declare
const
postMessage
:
typeof
__workerMain
.
postMessage
;
declare
const
Worker
:
typeof
__workers
.
WorkerImpl
;
declare
const
Worker
:
typeof
__workers
.
WorkerImpl
;
...
@@ -3490,7 +3490,7 @@ declare namespace __workerMain {
...
@@ -3490,7 +3490,7 @@ declare namespace __workerMain {
export
function
getMessage
():
Promise
<
any
>
;
export
function
getMessage
():
Promise
<
any
>
;
export
let
isClosing
:
boolean
;
export
let
isClosing
:
boolean
;
export
function
workerClose
():
void
;
export
function
workerClose
():
void
;
export
function
workerMain
():
Promise
<
void
>
;
export
function
bootstrapWorkerRuntime
():
Promise
<
void
>
;
}
}
declare
namespace
__workers
{
declare
namespace
__workers
{
...
...
cli/js/main.ts
浏览文件 @
5e2fd183
...
@@ -11,8 +11,8 @@ import { setLocation } from "./location.ts";
...
@@ -11,8 +11,8 @@ import { setLocation } from "./location.ts";
import
{
setBuildInfo
}
from
"
./build.ts
"
;
import
{
setBuildInfo
}
from
"
./build.ts
"
;
import
{
setSignals
}
from
"
./process.ts
"
;
import
{
setSignals
}
from
"
./process.ts
"
;
function
denoMain
(
preserveDenoNamespace
=
true
,
name
?:
string
):
void
{
function
bootstrapMainRuntime
(
):
void
{
const
s
=
os
.
start
(
preserveDenoNamespace
,
nam
e
);
const
s
=
os
.
start
(
tru
e
);
setBuildInfo
(
s
.
os
,
s
.
arch
);
setBuildInfo
(
s
.
os
,
s
.
arch
);
setSignals
();
setSignals
();
...
@@ -35,4 +35,4 @@ function denoMain(preserveDenoNamespace = true, name?: string): void {
...
@@ -35,4 +35,4 @@ function denoMain(preserveDenoNamespace = true, name?: string): void {
replLoop
();
replLoop
();
}
}
}
}
globalThis
[
"
denoMain
"
]
=
denoMain
;
globalThis
[
"
bootstrapMainRuntime
"
]
=
bootstrapMainRuntime
;
cli/js/os.ts
浏览文件 @
5e2fd183
...
@@ -84,13 +84,10 @@ interface Start {
...
@@ -84,13 +84,10 @@ interface Start {
arch
:
Arch
;
arch
:
Arch
;
}
}
// This function bootstraps an environment within Deno, it is shared both by
// TODO(bartlomieju): temporary solution, must be fixed when moving
// the runtime and the compiler environments.
// dispatches to separate crates
// @internal
export
function
initOps
():
void
{
export
function
start
(
preserveDenoNamespace
=
true
,
source
?:
string
):
Start
{
const
ops
=
core
.
ops
();
const
ops
=
core
.
ops
();
// TODO(bartlomieju): this is a prototype, we should come up with
// something a bit more sophisticated
for
(
const
[
name
,
opId
]
of
Object
.
entries
(
ops
))
{
for
(
const
[
name
,
opId
]
of
Object
.
entries
(
ops
))
{
const
opName
=
`OP_
${
name
.
toUpperCase
()}
`
;
const
opName
=
`OP_
${
name
.
toUpperCase
()}
`
;
// Assign op ids to actual variables
// Assign op ids to actual variables
...
@@ -98,6 +95,13 @@ export function start(preserveDenoNamespace = true, source?: string): Start {
...
@@ -98,6 +95,13 @@ export function start(preserveDenoNamespace = true, source?: string): Start {
((
dispatch
as
unknown
)
as
{
[
key
:
string
]:
number
})[
opName
]
=
opId
;
((
dispatch
as
unknown
)
as
{
[
key
:
string
]:
number
})[
opName
]
=
opId
;
core
.
setAsyncHandler
(
opId
,
dispatch
.
getAsyncHandler
(
opName
));
core
.
setAsyncHandler
(
opId
,
dispatch
.
getAsyncHandler
(
opName
));
}
}
}
// This function bootstraps an environment within Deno, it is shared both by
// the runtime and the compiler environments.
// @internal
export
function
start
(
preserveDenoNamespace
=
true
,
source
?:
string
):
Start
{
initOps
();
// First we send an empty `Start` message to let the privileged side know we
// First we send an empty `Start` message to let the privileged side know we
// are ready. The response should be a `StartRes` message containing the CLI
// are ready. The response should be a `StartRes` message containing the CLI
// args and other info.
// args and other info.
...
...
cli/js/worker_main.ts
浏览文件 @
5e2fd183
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
/* eslint-disable @typescript-eslint/no-explicit-any */
/* eslint-disable @typescript-eslint/no-explicit-any */
import
{
core
}
from
"
./core.ts
"
;
import
*
as
dispatch
from
"
./dispatch.ts
"
;
import
*
as
dispatch
from
"
./dispatch.ts
"
;
import
{
sendAsync
,
sendSync
}
from
"
./dispatch_json.ts
"
;
import
{
sendAsync
,
sendSync
}
from
"
./dispatch_json.ts
"
;
import
{
log
}
from
"
./util.ts
"
;
import
{
log
}
from
"
./util.ts
"
;
import
{
TextDecoder
,
TextEncoder
}
from
"
./text_encoding.ts
"
;
import
{
TextDecoder
,
TextEncoder
}
from
"
./text_encoding.ts
"
;
import
{
initOps
}
from
"
./os.ts
"
;
const
encoder
=
new
TextEncoder
();
const
encoder
=
new
TextEncoder
();
const
decoder
=
new
TextDecoder
();
const
decoder
=
new
TextDecoder
();
...
@@ -44,24 +44,15 @@ export function workerClose(): void {
...
@@ -44,24 +44,15 @@ export function workerClose(): void {
isClosing
=
true
;
isClosing
=
true
;
}
}
export
async
function
workerMain
():
Promise
<
void
>
{
export
async
function
bootstrapWorkerRuntime
():
Promise
<
void
>
{
const
ops
=
core
.
ops
();
initOps
();
// TODO(bartlomieju): this is a prototype, we should come up with
// something a bit more sophisticated
for
(
const
[
name
,
opId
]
of
Object
.
entries
(
ops
))
{
const
opName
=
`OP_
${
name
.
toUpperCase
()}
`
;
// Assign op ids to actual variables
// TODO(ry) This type casting is gross and should be fixed.
((
dispatch
as
unknown
)
as
{
[
key
:
string
]:
number
})[
opName
]
=
opId
;
core
.
setAsyncHandler
(
opId
,
dispatch
.
getAsyncHandler
(
opName
));
}
log
(
"
workerMain
"
);
log
(
"
bootstrapWorkerRuntime
"
);
while
(
!
isClosing
)
{
while
(
!
isClosing
)
{
const
data
=
await
getMessage
();
const
data
=
await
getMessage
();
if
(
data
==
null
)
{
if
(
data
==
null
)
{
log
(
"
workerMain
got null message. quitting.
"
);
log
(
"
bootstrapWorkerRuntime
got null message. quitting.
"
);
break
;
break
;
}
}
...
...
cli/lib.rs
浏览文件 @
5e2fd183
...
@@ -260,7 +260,7 @@ fn info_command(flags: DenoFlags) {
...
@@ -260,7 +260,7 @@ fn info_command(flags: DenoFlags) {
let
main_module
=
state
.main_module
.as_ref
()
.unwrap
()
.clone
();
let
main_module
=
state
.main_module
.as_ref
()
.unwrap
()
.clone
();
// Setup runtime.
// Setup runtime.
js_check
(
worker
.execute
(
"
denoMain
()"
));
js_check
(
worker
.execute
(
"
bootstrapMainRuntime
()"
));
debug!
(
"main_module {}"
,
main_module
);
debug!
(
"main_module {}"
,
main_module
);
let
main_future
=
async
move
{
let
main_future
=
async
move
{
...
@@ -282,7 +282,7 @@ fn fetch_command(flags: DenoFlags) {
...
@@ -282,7 +282,7 @@ fn fetch_command(flags: DenoFlags) {
let
main_module
=
state
.main_module
.as_ref
()
.unwrap
()
.clone
();
let
main_module
=
state
.main_module
.as_ref
()
.unwrap
()
.clone
();
// Setup runtime.
// Setup runtime.
js_check
(
worker
.execute
(
"
denoMain
()"
));
js_check
(
worker
.execute
(
"
bootstrapMainRuntime
()"
));
debug!
(
"main_module {}"
,
main_module
);
debug!
(
"main_module {}"
,
main_module
);
let
main_future
=
async
move
{
let
main_future
=
async
move
{
...
@@ -300,7 +300,7 @@ fn eval_command(flags: DenoFlags) {
...
@@ -300,7 +300,7 @@ fn eval_command(flags: DenoFlags) {
let
main_module
=
let
main_module
=
ModuleSpecifier
::
resolve_url_or_path
(
"./__$deno$eval.ts"
)
.unwrap
();
ModuleSpecifier
::
resolve_url_or_path
(
"./__$deno$eval.ts"
)
.unwrap
();
js_check
(
worker
.execute
(
"
denoMain
()"
));
js_check
(
worker
.execute
(
"
bootstrapMainRuntime
()"
));
debug!
(
"main_module {}"
,
&
main_module
);
debug!
(
"main_module {}"
,
&
main_module
);
let
main_future
=
async
move
{
let
main_future
=
async
move
{
...
@@ -346,7 +346,7 @@ fn bundle_command(flags: DenoFlags) {
...
@@ -346,7 +346,7 @@ fn bundle_command(flags: DenoFlags) {
fn
run_repl
(
flags
:
DenoFlags
)
{
fn
run_repl
(
flags
:
DenoFlags
)
{
let
(
mut
worker
,
_
state
)
=
create_worker_and_state
(
flags
);
let
(
mut
worker
,
_
state
)
=
create_worker_and_state
(
flags
);
js_check
(
worker
.execute
(
"
denoMain
()"
));
js_check
(
worker
.execute
(
"
bootstrapMainRuntime
()"
));
let
main_future
=
async
move
{
let
main_future
=
async
move
{
loop
{
loop
{
let
result
=
worker
.clone
()
.await
;
let
result
=
worker
.clone
()
.await
;
...
@@ -371,7 +371,7 @@ fn run_script(flags: DenoFlags) {
...
@@ -371,7 +371,7 @@ fn run_script(flags: DenoFlags) {
// Normal situation of executing a module.
// Normal situation of executing a module.
// Setup runtime.
// Setup runtime.
js_check
(
worker
.execute
(
"
denoMain
()"
));
js_check
(
worker
.execute
(
"
bootstrapMainRuntime
()"
));
debug!
(
"main_module {}"
,
main_module
);
debug!
(
"main_module {}"
,
main_module
);
let
mut
worker_
=
worker
.clone
();
let
mut
worker_
=
worker
.clone
();
...
...
cli/ops/worker_host.rs
浏览文件 @
5e2fd183
...
@@ -115,7 +115,7 @@ fn op_create_worker(
...
@@ -115,7 +115,7 @@ fn op_create_worker(
let
name
=
format!
(
"USER-WORKER-{}"
,
specifier
);
let
name
=
format!
(
"USER-WORKER-{}"
,
specifier
);
let
mut
worker
=
let
mut
worker
=
WebWorker
::
new
(
name
,
startup_data
::
deno_isolate_init
(),
child_state
,
ext
);
WebWorker
::
new
(
name
,
startup_data
::
deno_isolate_init
(),
child_state
,
ext
);
js_check
(
worker
.execute
(
"
workerMain
()"
));
js_check
(
worker
.execute
(
"
bootstrapWorkerRuntime
()"
));
let
worker_id
=
parent_state
.add_child_worker
(
worker
.clone
());
let
worker_id
=
parent_state
.add_child_worker
(
worker
.clone
());
...
@@ -269,7 +269,7 @@ fn op_host_resume_worker(
...
@@ -269,7 +269,7 @@ fn op_host_resume_worker(
let
mut
workers_table
=
state_
.workers
.lock
()
.unwrap
();
let
mut
workers_table
=
state_
.workers
.lock
()
.unwrap
();
let
worker
=
workers_table
.get_mut
(
&
id
)
.unwrap
();
let
worker
=
workers_table
.get_mut
(
&
id
)
.unwrap
();
js_check
(
worker
.execute
(
"
workerMain
()"
));
js_check
(
worker
.execute
(
"
bootstrapWorkerRuntime
()"
));
Ok
(
JsonOp
::
Sync
(
json!
({})))
Ok
(
JsonOp
::
Sync
(
json!
({})))
}
}
...
...
cli/worker.rs
浏览文件 @
5e2fd183
...
@@ -339,7 +339,7 @@ mod tests {
...
@@ -339,7 +339,7 @@ mod tests {
state
,
state
,
ext
,
ext
,
);
);
worker
.execute
(
"
denoMain
()"
)
.unwrap
();
worker
.execute
(
"
bootstrapMainRuntime
()"
)
.unwrap
();
let
result
=
worker
let
result
=
worker
.execute_mod_async
(
&
module_specifier
,
None
,
false
)
.execute_mod_async
(
&
module_specifier
,
None
,
false
)
.await
;
.await
;
...
@@ -371,8 +371,8 @@ mod tests {
...
@@ -371,8 +371,8 @@ mod tests {
state
,
state
,
ext
,
ext
,
);
);
worker
.execute
(
"
denoMain
()"
)
.unwrap
();
worker
.execute
(
"
bootstrapMainRuntime
()"
)
.unwrap
();
worker
.execute
(
"
workerMain
()"
)
.unwrap
();
worker
.execute
(
"
bootstrapWorkerRuntime
()"
)
.unwrap
();
worker
worker
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录