mirror of
https://github.com/denoland/deno.git
synced 2024-11-29 16:30:56 -05:00
498f6ad431
readSync and writeSync use dispatch_minimal now.
597 lines
8.1 KiB
Text
597 lines
8.1 KiB
Text
union Any {
|
|
Accept,
|
|
ApplySourceMap,
|
|
Cache,
|
|
Chdir,
|
|
Chmod,
|
|
Chown,
|
|
Close,
|
|
CopyFile,
|
|
CreateWorker,
|
|
CreateWorkerRes,
|
|
Cwd,
|
|
CwdRes,
|
|
Dial,
|
|
Environ,
|
|
EnvironRes,
|
|
Exit,
|
|
Fetch,
|
|
FetchSourceFile,
|
|
FetchSourceFileRes,
|
|
FetchRes,
|
|
FormatError,
|
|
FormatErrorRes,
|
|
GetRandomValues,
|
|
GlobalTimer,
|
|
GlobalTimerRes,
|
|
GlobalTimerStop,
|
|
HostGetMessage,
|
|
HostGetMessageRes,
|
|
HostGetWorkerClosed,
|
|
HostPostMessage,
|
|
IsTTY,
|
|
IsTTYRes,
|
|
Kill,
|
|
Link,
|
|
Listen,
|
|
ListenRes,
|
|
MakeTempDir,
|
|
MakeTempDirRes,
|
|
Metrics,
|
|
MetricsRes,
|
|
Mkdir,
|
|
NewConn,
|
|
Now,
|
|
NowRes,
|
|
Open,
|
|
OpenRes,
|
|
PermissionRevoke,
|
|
Permissions,
|
|
PermissionsRes,
|
|
ReadDir,
|
|
ReadDirRes,
|
|
Readlink,
|
|
ReadlinkRes,
|
|
Remove,
|
|
Rename,
|
|
ReplReadline,
|
|
ReplReadlineRes,
|
|
ReplStart,
|
|
ReplStartRes,
|
|
Resources,
|
|
ResourcesRes,
|
|
Run,
|
|
RunRes,
|
|
RunStatus,
|
|
RunStatusRes,
|
|
Seek,
|
|
SetEnv,
|
|
Shutdown,
|
|
Start,
|
|
StartRes,
|
|
Stat,
|
|
StatRes,
|
|
Symlink,
|
|
Truncate,
|
|
HomeDir,
|
|
HomeDirRes,
|
|
ExecPath,
|
|
ExecPathRes,
|
|
Utime,
|
|
WorkerGetMessage,
|
|
WorkerGetMessageRes,
|
|
WorkerPostMessage,
|
|
}
|
|
|
|
enum ErrorKind: byte {
|
|
NoError = 0,
|
|
|
|
// io errors
|
|
|
|
NotFound,
|
|
PermissionDenied,
|
|
ConnectionRefused,
|
|
ConnectionReset,
|
|
ConnectionAborted,
|
|
NotConnected,
|
|
AddrInUse,
|
|
AddrNotAvailable,
|
|
BrokenPipe,
|
|
AlreadyExists,
|
|
WouldBlock,
|
|
InvalidInput,
|
|
InvalidData,
|
|
TimedOut,
|
|
Interrupted,
|
|
WriteZero,
|
|
Other,
|
|
UnexpectedEof,
|
|
BadResource,
|
|
CommandFailed,
|
|
|
|
// url errors
|
|
|
|
EmptyHost,
|
|
IdnaError,
|
|
InvalidPort,
|
|
InvalidIpv4Address,
|
|
InvalidIpv6Address,
|
|
InvalidDomainCharacter,
|
|
RelativeUrlWithoutBase,
|
|
RelativeUrlWithCannotBeABaseBase,
|
|
SetHostOnCannotBeABaseUrl,
|
|
Overflow,
|
|
|
|
// hyper errors
|
|
|
|
HttpUser,
|
|
HttpClosed,
|
|
HttpCanceled,
|
|
HttpParse,
|
|
HttpOther,
|
|
TooLarge,
|
|
|
|
// custom errors
|
|
InvalidUri,
|
|
InvalidSeekMode,
|
|
OpNotAvailable,
|
|
WorkerInitFailed,
|
|
UnixError,
|
|
NoAsyncSupport,
|
|
NoSyncSupport,
|
|
ImportMapError,
|
|
InvalidPath,
|
|
ImportPrefixMissing,
|
|
UnsupportedFetchScheme,
|
|
TooManyRedirects,
|
|
|
|
// other kinds
|
|
Diagnostic,
|
|
JSError,
|
|
}
|
|
|
|
table Cwd {}
|
|
|
|
table CwdRes {
|
|
cwd: string;
|
|
}
|
|
|
|
enum MediaType: byte {
|
|
JavaScript = 0,
|
|
TypeScript,
|
|
Json,
|
|
Unknown
|
|
}
|
|
|
|
table Base {
|
|
cmd_id: uint32;
|
|
sync: bool = false;
|
|
error_kind: ErrorKind = NoError;
|
|
error: string;
|
|
inner: Any;
|
|
}
|
|
|
|
table Start {
|
|
unused: int8;
|
|
}
|
|
|
|
table StartRes {
|
|
cwd: string;
|
|
pid: uint32;
|
|
argv: [string];
|
|
main_module: string; // Absolute URL.
|
|
debug_flag: bool;
|
|
deps_flag: bool;
|
|
types_flag: bool;
|
|
version_flag: bool;
|
|
deno_version: string;
|
|
v8_version: string;
|
|
no_color: bool;
|
|
xeval_delim: string;
|
|
}
|
|
|
|
table FormatError {
|
|
error: string;
|
|
}
|
|
|
|
table FormatErrorRes {
|
|
error: string;
|
|
}
|
|
|
|
// Create worker as host
|
|
table CreateWorker {
|
|
specifier: string;
|
|
include_deno_namespace: bool;
|
|
has_source_code: bool;
|
|
source_code: string;
|
|
}
|
|
|
|
table CreateWorkerRes {
|
|
rid: uint32;
|
|
}
|
|
|
|
table HostGetWorkerClosed {
|
|
rid: uint32;
|
|
}
|
|
|
|
// Get message from guest worker as host
|
|
table HostGetMessage {
|
|
rid: uint32;
|
|
}
|
|
|
|
table HostGetMessageRes {
|
|
data: [ubyte];
|
|
}
|
|
|
|
// Post message to guest worker as host
|
|
table HostPostMessage {
|
|
rid: uint32;
|
|
// data passed thru the zero-copy data parameter.
|
|
}
|
|
|
|
// Get message from host as guest worker
|
|
table WorkerGetMessage {
|
|
unused: int8;
|
|
}
|
|
|
|
table WorkerGetMessageRes {
|
|
data: [ubyte];
|
|
}
|
|
|
|
// Post message to host as guest worker
|
|
table WorkerPostMessage {
|
|
// data passed thru the zero-copy data parameter.
|
|
}
|
|
|
|
table FetchSourceFile {
|
|
specifier: string;
|
|
referrer: string;
|
|
}
|
|
|
|
table FetchSourceFileRes {
|
|
// If it's a non-http module, moduleName and filename will be the same.
|
|
// For http modules, module_name is its resolved http URL, and filename
|
|
// is the location of the locally downloaded source code.
|
|
module_name: string;
|
|
filename: string;
|
|
media_type: MediaType;
|
|
data: [ubyte];
|
|
}
|
|
|
|
table ApplySourceMap {
|
|
filename: string;
|
|
line: int;
|
|
column: int;
|
|
}
|
|
|
|
table Cache {
|
|
extension: string;
|
|
module_id: string;
|
|
contents: string;
|
|
}
|
|
|
|
table Chdir {
|
|
directory: string;
|
|
}
|
|
|
|
table GlobalTimer {
|
|
timeout: int;
|
|
}
|
|
|
|
table GlobalTimerRes { }
|
|
|
|
table GlobalTimerStop { }
|
|
|
|
table Exit {
|
|
code: int;
|
|
}
|
|
|
|
table Environ {}
|
|
|
|
table SetEnv {
|
|
key: string;
|
|
value: string;
|
|
}
|
|
|
|
table EnvironRes {
|
|
map: [KeyValue];
|
|
}
|
|
|
|
table KeyValue {
|
|
key: string;
|
|
value: string;
|
|
}
|
|
|
|
table Permissions {}
|
|
|
|
table PermissionRevoke {
|
|
permission: string;
|
|
}
|
|
|
|
table PermissionsRes {
|
|
run: bool;
|
|
read: bool;
|
|
write: bool;
|
|
net: bool;
|
|
env: bool;
|
|
hrtime: bool;
|
|
}
|
|
|
|
// Note this represents The WHOLE header of an http message, not just the key
|
|
// value pairs. That means it includes method and url for Requests and status
|
|
// for responses. This is why it is singular "Header" instead of "Headers".
|
|
table HttpHeader {
|
|
is_request: bool;
|
|
// Request only:
|
|
method: string;
|
|
url: string;
|
|
// Response only:
|
|
status: uint16;
|
|
// Both:
|
|
fields: [KeyValue];
|
|
}
|
|
|
|
table Fetch {
|
|
header: HttpHeader;
|
|
}
|
|
|
|
table FetchRes {
|
|
header: HttpHeader;
|
|
body_rid: uint32;
|
|
}
|
|
|
|
table MakeTempDir {
|
|
dir: string;
|
|
prefix: string;
|
|
suffix: string;
|
|
}
|
|
|
|
table MakeTempDirRes {
|
|
path: string;
|
|
}
|
|
|
|
table Mkdir {
|
|
path: string;
|
|
recursive: bool;
|
|
mode: uint; // Specified by https://godoc.org/os#FileMode
|
|
}
|
|
|
|
table Chmod {
|
|
path: string;
|
|
mode: uint; // Specified by https://godoc.org/os#FileMode
|
|
}
|
|
|
|
table Chown {
|
|
path: string;
|
|
uid: uint;
|
|
gid: uint; // Specified by https://godoc.org/os#Chown
|
|
}
|
|
|
|
table Remove {
|
|
path: string;
|
|
recursive: bool;
|
|
}
|
|
|
|
table ReadDir {
|
|
path: string;
|
|
}
|
|
|
|
table ReadDirRes {
|
|
entries: [StatRes];
|
|
}
|
|
|
|
table CopyFile {
|
|
from: string;
|
|
to: string;
|
|
}
|
|
|
|
table Rename {
|
|
oldpath: string;
|
|
newpath: string;
|
|
}
|
|
|
|
table Readlink {
|
|
name: string;
|
|
}
|
|
|
|
table ReadlinkRes {
|
|
path: string;
|
|
}
|
|
|
|
table ReplStart {
|
|
history_file: string;
|
|
// TODO add config
|
|
}
|
|
|
|
table ReplStartRes {
|
|
rid: uint32;
|
|
}
|
|
|
|
table ReplReadline {
|
|
rid: uint32;
|
|
prompt: string;
|
|
}
|
|
|
|
table ReplReadlineRes {
|
|
line: string;
|
|
}
|
|
|
|
table Resources {}
|
|
|
|
table Resource {
|
|
rid: uint32;
|
|
repr: string;
|
|
}
|
|
|
|
table ResourcesRes {
|
|
resources: [Resource];
|
|
}
|
|
|
|
table Symlink {
|
|
oldname: string;
|
|
newname: string;
|
|
}
|
|
|
|
table Link {
|
|
oldname: string;
|
|
newname: string;
|
|
}
|
|
|
|
table Stat {
|
|
filename: string;
|
|
lstat: bool;
|
|
}
|
|
|
|
table StatRes {
|
|
is_file: bool;
|
|
is_symlink: bool;
|
|
len: ulong;
|
|
modified:ulong;
|
|
accessed:ulong;
|
|
created:ulong;
|
|
mode: uint;
|
|
has_mode: bool; // false on windows
|
|
name: string;
|
|
}
|
|
|
|
table Truncate {
|
|
name: string;
|
|
len: uint;
|
|
}
|
|
|
|
table HomeDir {}
|
|
|
|
table HomeDirRes {
|
|
path: string;
|
|
}
|
|
|
|
table ExecPath {}
|
|
|
|
table ExecPathRes {
|
|
path: string;
|
|
}
|
|
|
|
table Utime {
|
|
filename: string;
|
|
atime: uint64;
|
|
mtime: uint64;
|
|
}
|
|
|
|
table Open {
|
|
filename: string;
|
|
perm: uint;
|
|
mode: string;
|
|
}
|
|
|
|
table OpenRes {
|
|
rid: uint32;
|
|
}
|
|
|
|
table Close {
|
|
rid: uint32;
|
|
}
|
|
|
|
table Kill {
|
|
pid: int32;
|
|
signo: int32;
|
|
}
|
|
|
|
table Shutdown {
|
|
rid: uint32;
|
|
how: uint;
|
|
}
|
|
|
|
table Listen {
|
|
network: string;
|
|
address: string;
|
|
}
|
|
|
|
table ListenRes {
|
|
rid: uint32;
|
|
}
|
|
|
|
table Accept {
|
|
rid: uint32;
|
|
}
|
|
|
|
table Dial {
|
|
network: string;
|
|
address: string;
|
|
}
|
|
|
|
// Response to Accept and Dial.
|
|
table NewConn {
|
|
rid: uint32;
|
|
remote_addr: string;
|
|
local_addr: string;
|
|
}
|
|
|
|
table Metrics {}
|
|
|
|
table MetricsRes {
|
|
ops_dispatched: uint64;
|
|
ops_completed: uint64;
|
|
bytes_sent_control: uint64;
|
|
bytes_sent_data: uint64;
|
|
bytes_received: uint64;
|
|
}
|
|
|
|
enum ProcessStdio: byte { Inherit, Piped, Null }
|
|
|
|
table Run {
|
|
args: [string];
|
|
cwd: string;
|
|
env: [KeyValue];
|
|
stdin: ProcessStdio;
|
|
stdout: ProcessStdio;
|
|
stderr: ProcessStdio;
|
|
stdin_rid: uint32;
|
|
stdout_rid: uint32;
|
|
stderr_rid: uint32;
|
|
}
|
|
|
|
table RunRes {
|
|
rid: uint32;
|
|
pid: uint32;
|
|
// The following stdio rids are only valid if "Piped" was specified for the
|
|
// corresponding stdio stream. The caller MUST issue a close op for all valid
|
|
// stdio streams.
|
|
stdin_rid: uint32;
|
|
stdout_rid: uint32;
|
|
stderr_rid: uint32;
|
|
}
|
|
|
|
table RunStatus {
|
|
rid: uint32;
|
|
}
|
|
|
|
table RunStatusRes {
|
|
got_signal: bool;
|
|
exit_code: int;
|
|
exit_signal: int;
|
|
}
|
|
|
|
table Now {}
|
|
|
|
table NowRes {
|
|
seconds: uint64;
|
|
subsec_nanos: uint32;
|
|
}
|
|
|
|
table IsTTY {}
|
|
|
|
table IsTTYRes {
|
|
stdin: bool;
|
|
stdout: bool;
|
|
stderr: bool;
|
|
}
|
|
|
|
table Seek {
|
|
rid: uint32;
|
|
offset: int;
|
|
whence: uint;
|
|
}
|
|
|
|
table GetRandomValues {}
|
|
|
|
root_type Base;
|