From 725eb9810590e8237df68ec5580daaf0fa77e7d3 Mon Sep 17 00:00:00 2001 From: Ryan Dahl Date: Mon, 26 Aug 2019 22:29:51 -0400 Subject: [PATCH] Clean up various flatbuffer references (#2819) --- cli/ops/mod.rs | 1 - cli/ops/utils.rs | 49 ------------------------------ core/libdeno/BUILD.gn | 2 +- js/dispatch_minimal.ts | 1 - rollup.config.js | 17 ----------- tools/ts_library_builder/README.md | 6 ---- tsconfig.json | 3 -- website/manual.md | 12 ++------ 8 files changed, 3 insertions(+), 88 deletions(-) delete mode 100644 cli/ops/utils.rs diff --git a/cli/ops/mod.rs b/cli/ops/mod.rs index d254f34d2d..106948492d 100644 --- a/cli/ops/mod.rs +++ b/cli/ops/mod.rs @@ -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), diff --git a/cli/ops/utils.rs b/cli/ops/utils.rs deleted file mode 100644 index daa6150a60..0000000000 --- a/cli/ops/utils.rs +++ /dev/null @@ -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; - -#[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) -> Poll -where - F: FnOnce() -> Result, -{ - 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(is_sync: bool, f: F) -> CliOpResult -where - F: 'static + Send + FnOnce() -> Result, -{ - 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(), - )))) - } -} diff --git a/core/libdeno/BUILD.gn b/core/libdeno/BUILD.gn index 10ec4bf91c..2623fef2d5 100644 --- a/core/libdeno/BUILD.gn +++ b/core/libdeno/BUILD.gn @@ -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") { diff --git a/js/dispatch_minimal.ts b/js/dispatch_minimal.ts index 3df888e77e..75514368c9 100644 --- a/js/dispatch_minimal.ts +++ b/js/dispatch_minimal.ts @@ -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"; diff --git a/rollup.config.js b/rollup.config.js index 95f06f2b6f..793b5bd6cd 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -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(), diff --git a/tools/ts_library_builder/README.md b/tools/ts_library_builder/README.md index c96fba16b0..2eca169aee 100644 --- a/tools/ts_library_builder/README.md +++ b/tools/ts_library_builder/README.md @@ -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. diff --git a/tsconfig.json b/tsconfig.json index 500b0fcd0d..e9f8048df9 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -10,9 +10,6 @@ "noImplicitReturns": true, "noFallthroughCasesInSwitch": true, "noUnusedLocals": true, - "paths": { - "*": ["*", "target/debug/*", "target/release/*"] - }, "preserveConstEnums": true, "pretty": true, "removeComments": true, diff --git a/website/manual.md b/website/manual.md index 6cffa7f738..917d9a37d7 100644 --- a/website/manual.md +++ b/website/manual.md @@ -46,10 +46,8 @@ Deno provides 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