Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
deno
提交
3452a108
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,发现更多精彩内容 >>
提交
3452a108
编写于
4月 07, 2019
作者:
J
Jonathon Orsi
提交者:
Ryan Dahl
4月 07, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
use flatbuffer create functions to add fields (#2046)
上级
86aee7f1
变更
26
显示空白变更内容
内联
并排
Showing
26 changed file
with
98 addition
and
197 deletion
+98
-197
js/chmod.ts
js/chmod.ts
+1
-4
js/copy_file.ts
js/copy_file.ts
+1
-4
js/dir.ts
js/dir.ts
+1
-3
js/dispatch.ts
js/dispatch.ts
+10
-6
js/fetch.ts
js/fetch.ts
+14
-19
js/files.ts
js/files.ts
+5
-18
js/format_error.ts
js/format_error.ts
+1
-3
js/make_temp_dir.ts
js/make_temp_dir.ts
+9
-14
js/metrics.ts
js/metrics.ts
+1
-2
js/mkdir.ts
js/mkdir.ts
+1
-5
js/net.ts
js/net.ts
+4
-15
js/os.ts
js/os.ts
+12
-19
js/performance.ts
js/performance.ts
+1
-2
js/permissions.ts
js/permissions.ts
+5
-5
js/process.ts
js/process.ts
+12
-24
js/read_dir.ts
js/read_dir.ts
+1
-3
js/read_link.ts
js/read_link.ts
+1
-3
js/remove.ts
js/remove.ts
+1
-4
js/rename.ts
js/rename.ts
+1
-4
js/repl.ts
js/repl.ts
+2
-8
js/resources.ts
js/resources.ts
+1
-2
js/stat.ts
js/stat.ts
+1
-4
js/symlink.ts
js/symlink.ts
+1
-4
js/timers.ts
js/timers.ts
+1
-2
js/truncate.ts
js/truncate.ts
+1
-4
js/workers.ts
js/workers.ts
+9
-16
未找到文件。
js/chmod.ts
浏览文件 @
3452a108
...
...
@@ -9,10 +9,7 @@ function req(
):
[
flatbuffers
.
Builder
,
msg
.
Any
,
flatbuffers
.
Offset
]
{
const
builder
=
flatbuffers
.
createBuilder
();
const
path_
=
builder
.
createString
(
path
);
msg
.
Chmod
.
startChmod
(
builder
);
msg
.
Chmod
.
addPath
(
builder
,
path_
);
msg
.
Chmod
.
addMode
(
builder
,
mode
);
const
inner
=
msg
.
Chmod
.
endChmod
(
builder
);
const
inner
=
msg
.
Chmod
.
createChmod
(
builder
,
path_
,
mode
);
return
[
builder
,
msg
.
Any
.
Chmod
,
inner
];
}
...
...
js/copy_file.ts
浏览文件 @
3452a108
...
...
@@ -10,10 +10,7 @@ function req(
const
builder
=
flatbuffers
.
createBuilder
();
const
from_
=
builder
.
createString
(
from
);
const
to_
=
builder
.
createString
(
to
);
msg
.
CopyFile
.
startCopyFile
(
builder
);
msg
.
CopyFile
.
addFrom
(
builder
,
from_
);
msg
.
CopyFile
.
addTo
(
builder
,
to_
);
const
inner
=
msg
.
CopyFile
.
endCopyFile
(
builder
);
const
inner
=
msg
.
CopyFile
.
createCopyFile
(
builder
,
from_
,
to_
);
return
[
builder
,
msg
.
Any
.
CopyFile
,
inner
];
}
...
...
js/dir.ts
浏览文件 @
3452a108
...
...
@@ -30,8 +30,6 @@ export function cwd(): string {
export
function
chdir
(
directory
:
string
):
void
{
const
builder
=
flatbuffers
.
createBuilder
();
const
directory_
=
builder
.
createString
(
directory
);
msg
.
Chdir
.
startChdir
(
builder
);
msg
.
Chdir
.
addDirectory
(
builder
,
directory_
);
const
inner
=
msg
.
Chdir
.
endChdir
(
builder
);
const
inner
=
msg
.
Chdir
.
createChdir
(
builder
,
directory_
);
sendSync
(
builder
,
msg
.
Any
.
Chdir
,
inner
);
}
js/dispatch.ts
浏览文件 @
3452a108
...
...
@@ -31,12 +31,16 @@ function sendInternal(
sync
=
true
):
[
number
,
null
|
Uint8Array
]
{
const
cmdId
=
nextCmdId
++
;
msg
.
Base
.
startBase
(
builder
);
msg
.
Base
.
addInner
(
builder
,
inner
);
msg
.
Base
.
addInnerType
(
builder
,
innerType
);
msg
.
Base
.
addSync
(
builder
,
sync
);
msg
.
Base
.
addCmdId
(
builder
,
cmdId
);
builder
.
finish
(
msg
.
Base
.
endBase
(
builder
));
const
message
=
msg
.
Base
.
createBase
(
builder
,
cmdId
,
sync
,
0
,
0
,
innerType
,
inner
);
builder
.
finish
(
message
);
const
control
=
builder
.
asUint8Array
();
const
response
=
core
.
dispatch
(
control
,
zeroCopy
);
...
...
js/fetch.ts
浏览文件 @
3452a108
...
...
@@ -308,32 +308,29 @@ function msgHttpRequest(
method
:
null
|
string
,
headers
:
null
|
domTypes
.
Headers
):
flatbuffers
.
Offset
{
const
methodOffset
=
!
method
?
-
1
:
builder
.
createString
(
method
);
let
fieldsOffset
:
flatbuffers
.
Offset
=
-
1
;
const
methodOffset
=
!
method
?
0
:
builder
.
createString
(
method
);
let
fieldsOffset
:
flatbuffers
.
Offset
=
0
;
const
urlOffset
=
builder
.
createString
(
url
);
if
(
headers
)
{
const
kvOffsets
:
flatbuffers
.
Offset
[]
=
[];
for
(
const
[
key
,
val
]
of
headers
.
entries
())
{
const
keyOffset
=
builder
.
createString
(
key
);
const
valOffset
=
builder
.
createString
(
val
);
msg
.
KeyValue
.
startKeyValue
(
builder
);
msg
.
KeyValue
.
addKey
(
builder
,
keyOffset
);
msg
.
KeyValue
.
addValue
(
builder
,
valOffset
);
kvOffsets
.
push
(
msg
.
KeyValue
.
endKeyValue
(
builder
));
kvOffsets
.
push
(
msg
.
KeyValue
.
createKeyValue
(
builder
,
keyOffset
,
valOffset
)
);
}
fieldsOffset
=
msg
.
HttpHeader
.
createFieldsVector
(
builder
,
kvOffsets
);
}
else
{
}
msg
.
HttpHeader
.
startHttpHeader
(
builder
);
msg
.
HttpHeader
.
addIsRequest
(
builder
,
true
);
msg
.
HttpHeader
.
addUrl
(
builder
,
urlOffset
);
if
(
methodOffset
>=
0
)
{
msg
.
HttpHeader
.
addMethod
(
builder
,
methodOffset
);
}
if
(
fieldsOffset
>=
0
)
{
msg
.
HttpHeader
.
addFields
(
builder
,
fieldsOffset
);
}
return
msg
.
HttpHeader
.
endHttpHeader
(
builder
);
return
msg
.
HttpHeader
.
createHttpHeader
(
builder
,
true
,
methodOffset
,
urlOffset
,
0
,
fieldsOffset
);
}
function
deserializeHeaderFields
(
m
:
msg
.
HttpHeader
):
Array
<
[
string
,
string
]
>
{
...
...
@@ -405,12 +402,10 @@ export async function fetch(
// Send Fetch message
const
builder
=
flatbuffers
.
createBuilder
();
const
headerOff
=
msgHttpRequest
(
builder
,
url
,
method
,
headers
);
msg
.
Fetch
.
startFetch
(
builder
);
msg
.
Fetch
.
addHeader
(
builder
,
headerOff
);
const
resBase
=
await
sendAsync
(
builder
,
msg
.
Any
.
Fetch
,
msg
.
Fetch
.
endFetch
(
builder
),
msg
.
Fetch
.
createFetch
(
builder
,
headerOff
),
body
);
...
...
js/files.ts
浏览文件 @
3452a108
...
...
@@ -22,10 +22,7 @@ function reqOpen(
const
builder
=
flatbuffers
.
createBuilder
();
const
filename_
=
builder
.
createString
(
filename
);
const
mode_
=
builder
.
createString
(
mode
);
msg
.
Open
.
startOpen
(
builder
);
msg
.
Open
.
addFilename
(
builder
,
filename_
);
msg
.
Open
.
addMode
(
builder
,
mode_
);
const
inner
=
msg
.
Open
.
endOpen
(
builder
);
const
inner
=
msg
.
Open
.
createOpen
(
builder
,
filename_
,
0
,
mode_
);
return
[
builder
,
msg
.
Any
.
Open
,
inner
];
}
...
...
@@ -66,9 +63,7 @@ function reqRead(
p
:
Uint8Array
):
[
flatbuffers
.
Builder
,
msg
.
Any
,
flatbuffers
.
Offset
,
Uint8Array
]
{
const
builder
=
flatbuffers
.
createBuilder
();
msg
.
Read
.
startRead
(
builder
);
msg
.
Read
.
addRid
(
builder
,
rid
);
const
inner
=
msg
.
Read
.
endRead
(
builder
);
const
inner
=
msg
.
Read
.
createRead
(
builder
,
rid
);
return
[
builder
,
msg
.
Any
.
Read
,
inner
,
p
];
}
...
...
@@ -114,9 +109,7 @@ function reqWrite(
p
:
Uint8Array
):
[
flatbuffers
.
Builder
,
msg
.
Any
,
flatbuffers
.
Offset
,
Uint8Array
]
{
const
builder
=
flatbuffers
.
createBuilder
();
msg
.
Write
.
startWrite
(
builder
);
msg
.
Write
.
addRid
(
builder
,
rid
);
const
inner
=
msg
.
Write
.
endWrite
(
builder
);
const
inner
=
msg
.
Write
.
createWrite
(
builder
,
rid
);
return
[
builder
,
msg
.
Any
.
Write
,
inner
,
p
];
}
...
...
@@ -163,11 +156,7 @@ function reqSeek(
whence
:
SeekMode
):
[
flatbuffers
.
Builder
,
msg
.
Any
,
flatbuffers
.
Offset
]
{
const
builder
=
flatbuffers
.
createBuilder
();
msg
.
Seek
.
startSeek
(
builder
);
msg
.
Seek
.
addRid
(
builder
,
rid
);
msg
.
Seek
.
addOffset
(
builder
,
offset
);
msg
.
Seek
.
addWhence
(
builder
,
whence
);
const
inner
=
msg
.
Seek
.
endSeek
(
builder
);
const
inner
=
msg
.
Seek
.
createSeek
(
builder
,
rid
,
offset
,
whence
);
return
[
builder
,
msg
.
Any
.
Seek
,
inner
];
}
...
...
@@ -198,9 +187,7 @@ export async function seek(
/** Close the file ID. */
export
function
close
(
rid
:
number
):
void
{
const
builder
=
flatbuffers
.
createBuilder
();
msg
.
Close
.
startClose
(
builder
);
msg
.
Close
.
addRid
(
builder
,
rid
);
const
inner
=
msg
.
Close
.
endClose
(
builder
);
const
inner
=
msg
.
Close
.
createClose
(
builder
,
rid
);
dispatch
.
sendSync
(
builder
,
msg
.
Any
.
Close
,
inner
);
}
...
...
js/format_error.ts
浏览文件 @
3452a108
...
...
@@ -7,9 +7,7 @@ import { assert } from "./util";
export
function
formatError
(
errString
:
string
):
string
{
const
builder
=
flatbuffers
.
createBuilder
();
const
errString_
=
builder
.
createString
(
errString
);
msg
.
FormatError
.
startFormatError
(
builder
);
msg
.
FormatError
.
addError
(
builder
,
errString_
);
const
offset
=
msg
.
FormatError
.
endFormatError
(
builder
);
const
offset
=
msg
.
FormatError
.
createFormatError
(
builder
,
errString_
);
const
baseRes
=
sendSync
(
builder
,
msg
.
Any
.
FormatError
,
offset
);
assert
(
baseRes
!=
null
);
assert
(
msg
.
Any
.
FormatErrorRes
===
baseRes
!
.
innerType
());
...
...
js/make_temp_dir.ts
浏览文件 @
3452a108
...
...
@@ -16,20 +16,15 @@ function req({
suffix
}:
MakeTempDirOptions
):
[
flatbuffers
.
Builder
,
msg
.
Any
,
flatbuffers
.
Offset
]
{
const
builder
=
flatbuffers
.
createBuilder
();
const
fbDir
=
dir
==
null
?
-
1
:
builder
.
createString
(
dir
);
const
fbPrefix
=
prefix
==
null
?
-
1
:
builder
.
createString
(
prefix
);
const
fbSuffix
=
suffix
==
null
?
-
1
:
builder
.
createString
(
suffix
);
msg
.
MakeTempDir
.
startMakeTempDir
(
builder
);
if
(
dir
!=
null
)
{
msg
.
MakeTempDir
.
addDir
(
builder
,
fbDir
);
}
if
(
prefix
!=
null
)
{
msg
.
MakeTempDir
.
addPrefix
(
builder
,
fbPrefix
);
}
if
(
suffix
!=
null
)
{
msg
.
MakeTempDir
.
addSuffix
(
builder
,
fbSuffix
);
}
const
inner
=
msg
.
MakeTempDir
.
endMakeTempDir
(
builder
);
const
fbDir
=
dir
==
null
?
0
:
builder
.
createString
(
dir
);
const
fbPrefix
=
prefix
==
null
?
0
:
builder
.
createString
(
prefix
);
const
fbSuffix
=
suffix
==
null
?
0
:
builder
.
createString
(
suffix
);
const
inner
=
msg
.
MakeTempDir
.
createMakeTempDir
(
builder
,
fbDir
,
fbPrefix
,
fbSuffix
);
return
[
builder
,
msg
.
Any
.
MakeTempDir
,
inner
];
}
...
...
js/metrics.ts
浏览文件 @
3452a108
...
...
@@ -14,8 +14,7 @@ export interface Metrics {
function
req
():
[
flatbuffers
.
Builder
,
msg
.
Any
,
flatbuffers
.
Offset
]
{
const
builder
=
flatbuffers
.
createBuilder
();
msg
.
Metrics
.
startMetrics
(
builder
);
const
inner
=
msg
.
Metrics
.
endMetrics
(
builder
);
const
inner
=
msg
.
Metrics
.
createMetrics
(
builder
);
return
[
builder
,
msg
.
Any
.
Metrics
,
inner
];
}
...
...
js/mkdir.ts
浏览文件 @
3452a108
...
...
@@ -10,11 +10,7 @@ function req(
):
[
flatbuffers
.
Builder
,
msg
.
Any
,
flatbuffers
.
Offset
]
{
const
builder
=
flatbuffers
.
createBuilder
();
const
path_
=
builder
.
createString
(
path
);
msg
.
Mkdir
.
startMkdir
(
builder
);
msg
.
Mkdir
.
addPath
(
builder
,
path_
);
msg
.
Mkdir
.
addRecursive
(
builder
,
recursive
);
msg
.
Mkdir
.
addMode
(
builder
,
mode
);
const
inner
=
msg
.
Mkdir
.
endMkdir
(
builder
);
const
inner
=
msg
.
Mkdir
.
createMkdir
(
builder
,
path_
,
recursive
,
mode
);
return
[
builder
,
msg
.
Any
.
Mkdir
,
inner
];
}
...
...
js/net.ts
浏览文件 @
3452a108
...
...
@@ -37,10 +37,7 @@ enum ShutdownMode {
function
shutdown
(
rid
:
number
,
how
:
ShutdownMode
):
void
{
const
builder
=
flatbuffers
.
createBuilder
();
msg
.
Shutdown
.
startShutdown
(
builder
);
msg
.
Shutdown
.
addRid
(
builder
,
rid
);
msg
.
Shutdown
.
addHow
(
builder
,
how
);
const
inner
=
msg
.
Shutdown
.
endShutdown
(
builder
);
const
inner
=
msg
.
Shutdown
.
createShutdown
(
builder
,
rid
,
how
);
const
baseRes
=
dispatch
.
sendSync
(
builder
,
msg
.
Any
.
Shutdown
,
inner
);
assert
(
baseRes
==
null
);
}
...
...
@@ -84,9 +81,7 @@ class ListenerImpl implements Listener {
async
accept
():
Promise
<
Conn
>
{
const
builder
=
flatbuffers
.
createBuilder
();
msg
.
Accept
.
startAccept
(
builder
);
msg
.
Accept
.
addRid
(
builder
,
this
.
rid
);
const
inner
=
msg
.
Accept
.
endAccept
(
builder
);
const
inner
=
msg
.
Accept
.
createAccept
(
builder
,
this
.
rid
);
const
baseRes
=
await
dispatch
.
sendAsync
(
builder
,
msg
.
Any
.
Accept
,
inner
);
assert
(
baseRes
!=
null
);
assert
(
msg
.
Any
.
NewConn
===
baseRes
!
.
innerType
());
...
...
@@ -140,10 +135,7 @@ export function listen(network: Network, address: string): Listener {
const
builder
=
flatbuffers
.
createBuilder
();
const
network_
=
builder
.
createString
(
network
);
const
address_
=
builder
.
createString
(
address
);
msg
.
Listen
.
startListen
(
builder
);
msg
.
Listen
.
addNetwork
(
builder
,
network_
);
msg
.
Listen
.
addAddress
(
builder
,
address_
);
const
inner
=
msg
.
Listen
.
endListen
(
builder
);
const
inner
=
msg
.
Listen
.
createListen
(
builder
,
network_
,
address_
);
const
baseRes
=
dispatch
.
sendSync
(
builder
,
msg
.
Any
.
Listen
,
inner
);
assert
(
baseRes
!=
null
);
assert
(
msg
.
Any
.
ListenRes
===
baseRes
!
.
innerType
());
...
...
@@ -183,10 +175,7 @@ export async function dial(network: Network, address: string): Promise<Conn> {
const
builder
=
flatbuffers
.
createBuilder
();
const
network_
=
builder
.
createString
(
network
);
const
address_
=
builder
.
createString
(
address
);
msg
.
Dial
.
startDial
(
builder
);
msg
.
Dial
.
addNetwork
(
builder
,
network_
);
msg
.
Dial
.
addAddress
(
builder
,
address_
);
const
inner
=
msg
.
Dial
.
endDial
(
builder
);
const
inner
=
msg
.
Dial
.
createDial
(
builder
,
network_
,
address_
);
const
baseRes
=
await
dispatch
.
sendAsync
(
builder
,
msg
.
Any
.
Dial
,
inner
);
assert
(
baseRes
!=
null
);
assert
(
msg
.
Any
.
NewConn
===
baseRes
!
.
innerType
());
...
...
js/os.ts
浏览文件 @
3452a108
...
...
@@ -36,8 +36,7 @@ interface ResponseModuleMetaData {
*/
export
function
isTTY
():
{
stdin
:
boolean
;
stdout
:
boolean
;
stderr
:
boolean
}
{
const
builder
=
flatbuffers
.
createBuilder
();
msg
.
IsTTY
.
startIsTTY
(
builder
);
const
inner
=
msg
.
IsTTY
.
endIsTTY
(
builder
);
const
inner
=
msg
.
IsTTY
.
createIsTTY
(
builder
);
const
baseRes
=
sendSync
(
builder
,
msg
.
Any
.
IsTTY
,
inner
)
!
;
assert
(
msg
.
Any
.
IsTTYRes
===
baseRes
.
innerType
());
const
res
=
new
msg
.
IsTTYRes
();
...
...
@@ -49,9 +48,7 @@ export function isTTY(): { stdin: boolean; stdout: boolean; stderr: boolean } {
/** Exit the Deno process with optional exit code. */
export
function
exit
(
exitCode
=
0
):
never
{
const
builder
=
flatbuffers
.
createBuilder
();
msg
.
Exit
.
startExit
(
builder
);
msg
.
Exit
.
addCode
(
builder
,
exitCode
);
const
inner
=
msg
.
Exit
.
endExit
(
builder
);
const
inner
=
msg
.
Exit
.
createExit
(
builder
,
exitCode
);
sendSync
(
builder
,
msg
.
Any
.
Exit
,
inner
);
return
util
.
unreachable
();
}
...
...
@@ -68,10 +65,11 @@ export function fetchModuleMetaData(
const
builder
=
flatbuffers
.
createBuilder
();
const
specifier_
=
builder
.
createString
(
specifier
);
const
referrer_
=
builder
.
createString
(
referrer
);
msg
.
FetchModuleMetaData
.
startFetchModuleMetaData
(
builder
);
msg
.
FetchModuleMetaData
.
addSpecifier
(
builder
,
specifier_
);
msg
.
FetchModuleMetaData
.
addReferrer
(
builder
,
referrer_
);
const
inner
=
msg
.
FetchModuleMetaData
.
endFetchModuleMetaData
(
builder
);
const
inner
=
msg
.
FetchModuleMetaData
.
createFetchModuleMetaData
(
builder
,
specifier_
,
referrer_
);
const
baseRes
=
sendSync
(
builder
,
msg
.
Any
.
FetchModuleMetaData
,
inner
);
assert
(
baseRes
!=
null
);
assert
(
...
...
@@ -94,12 +92,9 @@ export function fetchModuleMetaData(
function
setEnv
(
key
:
string
,
value
:
string
):
void
{
const
builder
=
flatbuffers
.
createBuilder
();
const
_key
=
builder
.
createString
(
key
);
const
_value
=
builder
.
createString
(
value
);
msg
.
SetEnv
.
startSetEnv
(
builder
);
msg
.
SetEnv
.
addKey
(
builder
,
_key
);
msg
.
SetEnv
.
addValue
(
builder
,
_value
);
const
inner
=
msg
.
SetEnv
.
endSetEnv
(
builder
);
const
key_
=
builder
.
createString
(
key
);
const
value_
=
builder
.
createString
(
value
);
const
inner
=
msg
.
SetEnv
.
createSetEnv
(
builder
,
key_
,
value_
);
sendSync
(
builder
,
msg
.
Any
.
SetEnv
,
inner
);
}
...
...
@@ -137,8 +132,7 @@ export function env(): { [index: string]: string } {
});
*/
const
builder
=
flatbuffers
.
createBuilder
();
msg
.
Environ
.
startEnviron
(
builder
);
const
inner
=
msg
.
Environ
.
endEnviron
(
builder
);
const
inner
=
msg
.
Environ
.
createEnviron
(
builder
);
const
baseRes
=
sendSync
(
builder
,
msg
.
Any
.
Environ
,
inner
)
!
;
assert
(
msg
.
Any
.
EnvironRes
===
baseRes
.
innerType
());
const
res
=
new
msg
.
EnvironRes
();
...
...
@@ -150,8 +144,7 @@ export function env(): { [index: string]: string } {
/** Send to the privileged side that we have setup and are ready. */
function
sendStart
():
msg
.
StartRes
{
const
builder
=
flatbuffers
.
createBuilder
();
msg
.
Start
.
startStart
(
builder
);
const
startOffset
=
msg
.
Start
.
endStart
(
builder
);
const
startOffset
=
msg
.
Start
.
createStart
(
builder
,
0
/* unused */
);
const
baseRes
=
sendSync
(
builder
,
msg
.
Any
.
Start
,
startOffset
);
assert
(
baseRes
!=
null
);
assert
(
msg
.
Any
.
StartRes
===
baseRes
!
.
innerType
());
...
...
js/performance.ts
浏览文件 @
3452a108
...
...
@@ -18,8 +18,7 @@ export class Performance {
*/
now
():
number
{
const
builder
=
flatbuffers
.
createBuilder
();
msg
.
Now
.
startNow
(
builder
);
const
inner
=
msg
.
Now
.
endNow
(
builder
);
const
inner
=
msg
.
Now
.
createNow
(
builder
);
const
baseRes
=
sendSync
(
builder
,
msg
.
Any
.
Now
,
inner
)
!
;
assert
(
msg
.
Any
.
NowRes
===
baseRes
.
innerType
());
const
res
=
new
msg
.
NowRes
();
...
...
js/permissions.ts
浏览文件 @
3452a108
...
...
@@ -19,8 +19,7 @@ export type Permission = keyof Permissions;
function
getReq
():
[
flatbuffers
.
Builder
,
msg
.
Any
,
flatbuffers
.
Offset
]
{
const
builder
=
flatbuffers
.
createBuilder
();
msg
.
Permissions
.
startPermissions
(
builder
);
const
inner
=
msg
.
Permissions
.
endPermissions
(
builder
);
const
inner
=
msg
.
Permissions
.
createPermissions
(
builder
);
return
[
builder
,
msg
.
Any
.
Permissions
,
inner
];
}
...
...
@@ -55,9 +54,10 @@ function revokeReq(
):
[
flatbuffers
.
Builder
,
msg
.
Any
,
flatbuffers
.
Offset
]
{
const
builder
=
flatbuffers
.
createBuilder
();
const
permission_
=
builder
.
createString
(
permission
);
msg
.
PermissionRevoke
.
startPermissionRevoke
(
builder
);
msg
.
PermissionRevoke
.
addPermission
(
builder
,
permission_
);
const
inner
=
msg
.
PermissionRevoke
.
endPermissionRevoke
(
builder
);
const
inner
=
msg
.
PermissionRevoke
.
createPermissionRevoke
(
builder
,
permission_
);
return
[
builder
,
msg
.
Any
.
PermissionRevoke
,
inner
];
}
...
...
js/process.ts
浏览文件 @
3452a108
...
...
@@ -34,9 +34,7 @@ export interface RunOptions {
async
function
runStatus
(
rid
:
number
):
Promise
<
ProcessStatus
>
{
const
builder
=
flatbuffers
.
createBuilder
();
msg
.
RunStatus
.
startRunStatus
(
builder
);
msg
.
RunStatus
.
addRid
(
builder
,
rid
);
const
inner
=
msg
.
RunStatus
.
endRunStatus
(
builder
);
const
inner
=
msg
.
RunStatus
.
createRunStatus
(
builder
,
rid
);
const
baseRes
=
await
dispatch
.
sendAsync
(
builder
,
msg
.
Any
.
RunStatus
,
inner
);
assert
(
baseRes
!=
null
);
...
...
@@ -154,35 +152,25 @@ export function run(opt: RunOptions): Process {
builder
,
opt
.
args
.
map
(
a
=>
builder
.
createString
(
a
))
);
const
cwdOffset
=
opt
.
cwd
==
null
?
-
1
:
builder
.
createString
(
opt
.
cwd
);
const
cwdOffset
=
opt
.
cwd
==
null
?
0
:
builder
.
createString
(
opt
.
cwd
);
const
kvOffset
:
flatbuffers
.
Offset
[]
=
[];
if
(
opt
.
env
)
{
for
(
const
[
key
,
val
]
of
Object
.
entries
(
opt
.
env
))
{
const
keyOffset
=
builder
.
createString
(
key
);
const
valOffset
=
builder
.
createString
(
String
(
val
));
msg
.
KeyValue
.
startKeyValue
(
builder
);
msg
.
KeyValue
.
addKey
(
builder
,
keyOffset
);
msg
.
KeyValue
.
addValue
(
builder
,
valOffset
);
kvOffset
.
push
(
msg
.
KeyValue
.
endKeyValue
(
builder
));
kvOffset
.
push
(
msg
.
KeyValue
.
createKeyValue
(
builder
,
keyOffset
,
valOffset
));
}
}
const
envOffset
=
msg
.
Run
.
createEnvVector
(
builder
,
kvOffset
);
msg
.
Run
.
startRun
(
builder
);
msg
.
Run
.
addArgs
(
builder
,
argsOffset
);
if
(
opt
.
cwd
!=
null
)
{
msg
.
Run
.
addCwd
(
builder
,
cwdOffset
);
}
msg
.
Run
.
addEnv
(
builder
,
envOffset
);
if
(
opt
.
stdin
)
{
msg
.
Run
.
addStdin
(
builder
,
stdioMap
(
opt
.
stdin
!
));
}
if
(
opt
.
stdout
)
{
msg
.
Run
.
addStdout
(
builder
,
stdioMap
(
opt
.
stdout
!
));
}
if
(
opt
.
stderr
)
{
msg
.
Run
.
addStderr
(
builder
,
stdioMap
(
opt
.
stderr
!
));
}
const
inner
=
msg
.
Run
.
endRun
(
builder
);
const
inner
=
msg
.
Run
.
createRun
(
builder
,
argsOffset
,
cwdOffset
,
envOffset
,
opt
.
stdin
?
stdioMap
(
opt
.
stdin
)
:
stdioMap
(
"
inherit
"
),
opt
.
stdout
?
stdioMap
(
opt
.
stdout
)
:
stdioMap
(
"
inherit
"
),
opt
.
stderr
?
stdioMap
(
opt
.
stderr
)
:
stdioMap
(
"
inherit
"
)
);
const
baseRes
=
dispatch
.
sendSync
(
builder
,
msg
.
Any
.
Run
,
inner
);
assert
(
baseRes
!=
null
);
assert
(
msg
.
Any
.
RunRes
===
baseRes
!
.
innerType
());
...
...
js/read_dir.ts
浏览文件 @
3452a108
...
...
@@ -8,9 +8,7 @@ import { assert } from "./util";
function
req
(
path
:
string
):
[
flatbuffers
.
Builder
,
msg
.
Any
,
flatbuffers
.
Offset
]
{
const
builder
=
flatbuffers
.
createBuilder
();
const
path_
=
builder
.
createString
(
path
);
msg
.
ReadDir
.
startReadDir
(
builder
);
msg
.
ReadDir
.
addPath
(
builder
,
path_
);
const
inner
=
msg
.
ReadDir
.
endReadDir
(
builder
);
const
inner
=
msg
.
ReadDir
.
createReadDir
(
builder
,
path_
);
return
[
builder
,
msg
.
Any
.
ReadDir
,
inner
];
}
...
...
js/read_link.ts
浏览文件 @
3452a108
...
...
@@ -7,9 +7,7 @@ import * as dispatch from "./dispatch";
function
req
(
name
:
string
):
[
flatbuffers
.
Builder
,
msg
.
Any
,
flatbuffers
.
Offset
]
{
const
builder
=
flatbuffers
.
createBuilder
();
const
name_
=
builder
.
createString
(
name
);
msg
.
Readlink
.
startReadlink
(
builder
);
msg
.
Readlink
.
addName
(
builder
,
name_
);
const
inner
=
msg
.
Readlink
.
endReadlink
(
builder
);
const
inner
=
msg
.
Readlink
.
createReadlink
(
builder
,
name_
);
return
[
builder
,
msg
.
Any
.
Readlink
,
inner
];
}
...
...
js/remove.ts
浏览文件 @
3452a108
...
...
@@ -13,10 +13,7 @@ function req(
):
[
flatbuffers
.
Builder
,
msg
.
Any
,
flatbuffers
.
Offset
]
{
const
builder
=
flatbuffers
.
createBuilder
();
const
path_
=
builder
.
createString
(
path
);
msg
.
Remove
.
startRemove
(
builder
);
msg
.
Remove
.
addPath
(
builder
,
path_
);
msg
.
Remove
.
addRecursive
(
builder
,
!!
options
.
recursive
);
const
inner
=
msg
.
Remove
.
endRemove
(
builder
);
const
inner
=
msg
.
Remove
.
createRemove
(
builder
,
path_
,
!!
options
.
recursive
);
return
[
builder
,
msg
.
Any
.
Remove
,
inner
];
}
...
...
js/rename.ts
浏览文件 @
3452a108
...
...
@@ -10,10 +10,7 @@ function req(
const
builder
=
flatbuffers
.
createBuilder
();
const
oldpath_
=
builder
.
createString
(
oldpath
);
const
newpath_
=
builder
.
createString
(
newpath
);
msg
.
Rename
.
startRename
(
builder
);
msg
.
Rename
.
addOldpath
(
builder
,
oldpath_
);
msg
.
Rename
.
addNewpath
(
builder
,
newpath_
);
const
inner
=
msg
.
Rename
.
endRename
(
builder
);
const
inner
=
msg
.
Rename
.
createRename
(
builder
,
oldpath_
,
newpath_
);
return
[
builder
,
msg
.
Any
.
Rename
,
inner
];
}
...
...
js/repl.ts
浏览文件 @
3452a108
...
...
@@ -30,10 +30,7 @@ const replCommands = {
function
startRepl
(
historyFile
:
string
):
number
{
const
builder
=
flatbuffers
.
createBuilder
();
const
historyFile_
=
builder
.
createString
(
historyFile
);
msg
.
ReplStart
.
startReplStart
(
builder
);
msg
.
ReplStart
.
addHistoryFile
(
builder
,
historyFile_
);
const
inner
=
msg
.
ReplStart
.
endReplStart
(
builder
);
const
inner
=
msg
.
ReplStart
.
createReplStart
(
builder
,
historyFile_
);
const
baseRes
=
dispatch
.
sendSync
(
builder
,
msg
.
Any
.
ReplStart
,
inner
);
assert
(
baseRes
!=
null
);
...
...
@@ -48,10 +45,7 @@ function startRepl(historyFile: string): number {
export
async
function
readline
(
rid
:
number
,
prompt
:
string
):
Promise
<
string
>
{
const
builder
=
flatbuffers
.
createBuilder
();
const
prompt_
=
builder
.
createString
(
prompt
);
msg
.
ReplReadline
.
startReplReadline
(
builder
);
msg
.
ReplReadline
.
addRid
(
builder
,
rid
);
msg
.
ReplReadline
.
addPrompt
(
builder
,
prompt_
);
const
inner
=
msg
.
ReplReadline
.
endReplReadline
(
builder
);
const
inner
=
msg
.
ReplReadline
.
createReplReadline
(
builder
,
rid
,
prompt_
);
const
baseRes
=
await
dispatch
.
sendAsync
(
builder
,
...
...
js/resources.ts
浏览文件 @
3452a108
...
...
@@ -13,8 +13,7 @@ export interface ResourceMap {
*/
export
function
resources
():
ResourceMap
{
const
builder
=
flatbuffers
.
createBuilder
();
msg
.
Resources
.
startResources
(
builder
);
const
inner
=
msg
.
Resource
.
endResource
(
builder
);
const
inner
=
msg
.
Resource
.
createResource
(
builder
,
0
,
0
);
const
baseRes
=
dispatch
.
sendSync
(
builder
,
msg
.
Any
.
Resources
,
inner
);
assert
(
baseRes
!==
null
);
assert
(
msg
.
Any
.
ResourcesRes
===
baseRes
!
.
innerType
());
...
...
js/stat.ts
浏览文件 @
3452a108
...
...
@@ -11,10 +11,7 @@ function req(
):
[
flatbuffers
.
Builder
,
msg
.
Any
,
flatbuffers
.
Offset
]
{
const
builder
=
flatbuffers
.
createBuilder
();
const
filename_
=
builder
.
createString
(
filename
);
msg
.
Stat
.
startStat
(
builder
);
msg
.
Stat
.
addFilename
(
builder
,
filename_
);
msg
.
Stat
.
addLstat
(
builder
,
lstat
);
const
inner
=
msg
.
Stat
.
endStat
(
builder
);
const
inner
=
msg
.
Stat
.
createStat
(
builder
,
filename_
,
lstat
);
return
[
builder
,
msg
.
Any
.
Stat
,
inner
];
}
...
...
js/symlink.ts
浏览文件 @
3452a108
...
...
@@ -16,10 +16,7 @@ function req(
const
builder
=
flatbuffers
.
createBuilder
();
const
oldname_
=
builder
.
createString
(
oldname
);
const
newname_
=
builder
.
createString
(
newname
);
msg
.
Symlink
.
startSymlink
(
builder
);
msg
.
Symlink
.
addOldname
(
builder
,
oldname_
);
msg
.
Symlink
.
addNewname
(
builder
,
newname_
);
const
inner
=
msg
.
Symlink
.
endSymlink
(
builder
);
const
inner
=
msg
.
Symlink
.
createSymlink
(
builder
,
oldname_
,
newname_
);
return
[
builder
,
msg
.
Any
.
Symlink
,
inner
];
}
...
...
js/timers.ts
浏览文件 @
3452a108
...
...
@@ -39,8 +39,7 @@ function getTime(): number {
function
clearGlobalTimeout
():
void
{
const
builder
=
flatbuffers
.
createBuilder
();
msg
.
GlobalTimerStop
.
startGlobalTimerStop
(
builder
);
const
inner
=
msg
.
GlobalTimerStop
.
endGlobalTimerStop
(
builder
);
const
inner
=
msg
.
GlobalTimerStop
.
createGlobalTimerStop
(
builder
);
globalTimeoutDue
=
null
;
let
res
=
sendSync
(
builder
,
msg
.
Any
.
GlobalTimerStop
,
inner
);
assert
(
res
==
null
);
...
...
js/truncate.ts
浏览文件 @
3452a108
...
...
@@ -10,10 +10,7 @@ function req(
const
builder
=
flatbuffers
.
createBuilder
();
const
name_
=
builder
.
createString
(
name
);
len
=
len
&&
len
>
0
?
Math
.
floor
(
len
)
:
0
;
msg
.
Truncate
.
startTruncate
(
builder
);
msg
.
Truncate
.
addName
(
builder
,
name_
);
msg
.
Truncate
.
addLen
(
builder
,
len
);
const
inner
=
msg
.
Truncate
.
endTruncate
(
builder
);
const
inner
=
msg
.
Truncate
.
createTruncate
(
builder
,
name_
,
len
);
return
[
builder
,
msg
.
Any
.
Truncate
,
inner
];
}
...
...
js/workers.ts
浏览文件 @
3452a108
...
...
@@ -23,9 +23,7 @@ export function decodeMessage(dataIntArray: Uint8Array): any {
function
createWorker
(
specifier
:
string
):
number
{
const
builder
=
flatbuffers
.
createBuilder
();
const
specifier_
=
builder
.
createString
(
specifier
);
msg
.
CreateWorker
.
startCreateWorker
(
builder
);
msg
.
CreateWorker
.
addSpecifier
(
builder
,
specifier_
);
const
inner
=
msg
.
CreateWorker
.
endCreateWorker
(
builder
);
const
inner
=
msg
.
CreateWorker
.
createCreateWorker
(
builder
,
specifier_
);
const
baseRes
=
sendSync
(
builder
,
msg
.
Any
.
CreateWorker
,
inner
);
assert
(
baseRes
!=
null
);
assert
(
...
...
@@ -39,18 +37,14 @@ function createWorker(specifier: string): number {
async
function
hostGetWorkerClosed
(
rid
:
number
):
Promise
<
void
>
{
const
builder
=
flatbuffers
.
createBuilder
();
msg
.
HostGetWorkerClosed
.
startHostGetWorkerClosed
(
builder
);
msg
.
HostGetWorkerClosed
.
addRid
(
builder
,
rid
);
const
inner
=
msg
.
HostGetWorkerClosed
.
endHostGetWorkerClosed
(
builder
);
const
inner
=
msg
.
HostGetWorkerClosed
.
createHostGetWorkerClosed
(
builder
,
rid
);
await
sendAsync
(
builder
,
msg
.
Any
.
HostGetWorkerClosed
,
inner
);
}
function
hostPostMessage
(
rid
:
number
,
data
:
any
):
void
{
const
dataIntArray
=
encodeMessage
(
data
);
const
builder
=
flatbuffers
.
createBuilder
();
msg
.
HostPostMessage
.
startHostPostMessage
(
builder
);
msg
.
HostPostMessage
.
addRid
(
builder
,
rid
);
const
inner
=
msg
.
HostPostMessage
.
endHostPostMessage
(
builder
);
const
inner
=
msg
.
HostPostMessage
.
createHostPostMessage
(
builder
,
rid
);
const
baseRes
=
sendSync
(
builder
,
msg
.
Any
.
HostPostMessage
,
...
...
@@ -62,9 +56,7 @@ function hostPostMessage(rid: number, data: any): void {
async
function
hostGetMessage
(
rid
:
number
):
Promise
<
any
>
{
const
builder
=
flatbuffers
.
createBuilder
();
msg
.
HostGetMessage
.
startHostGetMessage
(
builder
);
msg
.
HostGetMessage
.
addRid
(
builder
,
rid
);
const
inner
=
msg
.
HostGetMessage
.
endHostGetMessage
(
builder
);
const
inner
=
msg
.
HostGetMessage
.
createHostGetMessage
(
builder
,
rid
);
const
baseRes
=
await
sendAsync
(
builder
,
msg
.
Any
.
HostGetMessage
,
inner
);
assert
(
baseRes
!=
null
);
assert
(
...
...
@@ -88,8 +80,7 @@ export let onmessage: (e: { data: any }) => void = (): void => {};
export
function
postMessage
(
data
:
any
):
void
{
const
dataIntArray
=
encodeMessage
(
data
);
const
builder
=
flatbuffers
.
createBuilder
();
msg
.
WorkerPostMessage
.
startWorkerPostMessage
(
builder
);
const
inner
=
msg
.
WorkerPostMessage
.
endWorkerPostMessage
(
builder
);
const
inner
=
msg
.
WorkerPostMessage
.
createWorkerPostMessage
(
builder
);
const
baseRes
=
sendSync
(
builder
,
msg
.
Any
.
WorkerPostMessage
,
...
...
@@ -102,8 +93,10 @@ export function postMessage(data: any): void {
export
async
function
getMessage
():
Promise
<
any
>
{
log
(
"
getMessage
"
);
const
builder
=
flatbuffers
.
createBuilder
();
msg
.
WorkerGetMessage
.
startWorkerGetMessage
(
builder
);
const
inner
=
msg
.
WorkerGetMessage
.
endWorkerGetMessage
(
builder
);
const
inner
=
msg
.
WorkerGetMessage
.
createWorkerGetMessage
(
builder
,
0
/* unused */
);
const
baseRes
=
await
sendAsync
(
builder
,
msg
.
Any
.
WorkerGetMessage
,
inner
);
assert
(
baseRes
!=
null
);
assert
(
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录