1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-25 00:29:09 -05:00

Clean up various flatbuffer references (#2819)

This commit is contained in:
Ryan Dahl 2019-08-26 22:29:51 -04:00 committed by GitHub
parent f94900406d
commit 725eb98105
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 3 additions and 88 deletions

View file

@ -20,7 +20,6 @@ mod random;
mod repl;
mod resources;
mod timers;
mod utils;
mod workers;
// Warning! These values are duplicated in the TypeScript code (js/dispatch.ts),

View file

@ -1,49 +0,0 @@
#![allow(dead_code)]
use crate::tokio_util;
use deno::Buf;
use deno::ErrBox;
use deno::Op;
use deno::OpResult;
use futures::Poll;
pub type CliOpResult = OpResult<ErrBox>;
#[inline]
pub fn ok_buf(buf: Buf) -> CliOpResult {
Ok(Op::Sync(buf))
}
#[inline]
pub fn empty_buf() -> Buf {
Box::new([])
}
// This is just type conversion. Implement From trait?
// See https://github.com/tokio-rs/tokio/blob/ffd73a64e7ec497622b7f939e38017afe7124dc4/tokio-fs/src/lib.rs#L76-L85
pub fn convert_blocking<F>(f: F) -> Poll<Buf, ErrBox>
where
F: FnOnce() -> Result<Buf, ErrBox>,
{
use futures::Async::*;
match tokio_threadpool::blocking(f) {
Ok(Ready(Ok(v))) => Ok(v.into()),
Ok(Ready(Err(err))) => Err(err),
Ok(NotReady) => Ok(NotReady),
Err(err) => panic!("blocking error {}", err),
}
}
pub fn blocking<F>(is_sync: bool, f: F) -> CliOpResult
where
F: 'static + Send + FnOnce() -> Result<Buf, ErrBox>,
{
if is_sync {
let result_buf = f()?;
Ok(Op::Sync(result_buf))
} else {
Ok(Op::Async(Box::new(futures::sync::oneshot::spawn(
tokio_util::poll_fn(move || convert_blocking(f)),
&tokio_executor::DefaultExecutor::current(),
))))
}
}

View file

@ -38,7 +38,7 @@ v8_source_set("v8") {
}
# Only functionality needed for libdeno_test and snapshot_creator
# In particular no flatbuffers, no assets, no rust, no msg handlers.
# In particular no assets, no rust, no msg handlers.
# Because snapshots are slow, it's important that snapshot_creator's
# dependencies are minimal.
v8_source_set("libdeno") {

View file

@ -1,5 +1,4 @@
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
// Do not add flatbuffer dependencies to this module.
import * as util from "./util";
import { core } from "./core";

View file

@ -88,20 +88,6 @@ const osNodeToDeno = {
linux: "linux"
};
// This plugin resolves at bundle time any generated resources that are
// in the build path under `gen` and specified with a MID starting with `gen/`.
// The plugin assumes that the MID needs to have the `.ts` extension appended.
function resolveGenerated() {
return {
name: "resolve-msg-generated",
resolveId(importee) {
if (importee.startsWith("gen/cli/msg_generated")) {
return path.resolve(`${importee}.ts`);
}
}
};
}
function generateDepFile({ outputFile, sourceFiles = [], configFiles = [] }) {
let timestamp = new Date();
@ -214,9 +200,6 @@ export default function makeConfig(commandOptions) {
]
}),
// Resolves any resources that have been generated at build time
resolveGenerated(),
// Allows rollup to resolve modules based on Node.js resolution
nodeResolve(),

View file

@ -60,12 +60,6 @@ like this:
- We process the `deno` namespace/module, by "flattening" the type definition
file.
- We determine the exported symbols for `js/deno.ts`.
- We create a custom extraction of the `gen/msg_generated.ts` which is
generated during the build process and contains the type information related
to flatbuffer structures that communicate between the privileged part of
deno and the user land. Currently, the tool doesn't do full complex
dependency analysis to be able to determine what is required out of this
file, so we explicitly extract the type information we need.
- We recurse over all imports/exports of the modules, only exporting those
symbols which are finally exported by `js/deno.ts`.
- We replace the import/export with the type information from the source file.

View file

@ -10,9 +10,6 @@
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true,
"noUnusedLocals": true,
"paths": {
"*": ["*", "target/debug/*", "target/release/*"]
},
"preserveConstEnums": true,
"pretty": true,
"removeComments": true,

View file

@ -46,10 +46,8 @@ Deno provides <a href="https://github.com/denoland/deno_std">a set of reviewed
- File system and network access can be controlled in order to run sandboxed
code. Access between V8 (unprivileged) and Rust (privileged) is only done via
serialized messages defined in this
[flatbuffer](https://github.com/denoland/deno/blob/master/cli/msg.fbs). This
makes it easy to audit. For example, to enable write access use the flag
`--allow-write` or for network access `--allow-net`.
serialized messages. This makes it easy to audit. For example, to enable write
access use the flag `--allow-write` or for network access `--allow-net`.
- Only ship a single executable.
@ -1029,12 +1027,6 @@ The core binding layer for Deno. It is released as a
with a binding API called "libdeno". See the crate documentation for more
details.
### Flatbuffers
We use Flatbuffers to define common structs and enums between TypeScript and
Rust. These common data structures are defined in
[msg.fbs](https://github.com/denoland/deno/blob/master/cli/msg.fbs)
### Updating prebuilt binaries
```shell