summaryrefslogtreecommitdiff
path: root/cli/compilers/compiler_worker.rs
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2020-05-08 16:18:00 +0200
committerGitHub <noreply@github.com>2020-05-08 16:18:00 +0200
commitf9f10229a41d000ae9e96f0907ca321f9ffdeea7 (patch)
tree57e935dc1199373ac841cfd0359ab1b1541bc55f /cli/compilers/compiler_worker.rs
parent6b73e0caff9673965df7a096c360ac336eb1cba0 (diff)
refactor: Remove cli::compilers module (#5138)
This PR removes "cli/compilers/" directory. "cli/compilers/ts.rs" has been renamed to "cli/tsc.rs"
Diffstat (limited to 'cli/compilers/compiler_worker.rs')
-rw-r--r--cli/compilers/compiler_worker.rs66
1 files changed, 0 insertions, 66 deletions
diff --git a/cli/compilers/compiler_worker.rs b/cli/compilers/compiler_worker.rs
deleted file mode 100644
index aa84c8695..000000000
--- a/cli/compilers/compiler_worker.rs
+++ /dev/null
@@ -1,66 +0,0 @@
-// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
-use crate::ops;
-use crate::state::State;
-use crate::web_worker::WebWorker;
-use core::task::Context;
-use deno_core::ErrBox;
-use deno_core::StartupData;
-use futures::future::Future;
-use futures::future::FutureExt;
-use std::ops::Deref;
-use std::ops::DerefMut;
-use std::pin::Pin;
-use std::task::Poll;
-
-/// This worker is used to host TypeScript and WASM compilers.
-///
-/// It provides minimal set of ops that are necessary to facilitate
-/// compilation.
-///
-/// NOTE: This worker is considered priveleged, because it may
-/// access file system without permission check.
-///
-/// At the moment this worker is meant to be single-use - after
-/// performing single compilation/bundling it should be destroyed.
-///
-/// TODO(bartlomieju): add support to reuse the worker - or in other
-/// words support stateful TS compiler
-pub struct CompilerWorker(WebWorker);
-
-impl CompilerWorker {
- pub fn new(name: String, startup_data: StartupData, state: State) -> Self {
- let state_ = state.clone();
- let mut worker = WebWorker::new(name, startup_data, state_, false);
- {
- let isolate = &mut worker.isolate;
- ops::compiler::init(isolate, &state);
- // TODO(bartlomieju): CompilerWorker should not
- // depend on those ops
- ops::os::init(isolate, &state);
- ops::fs::init(isolate, &state);
- }
- Self(worker)
- }
-}
-
-impl Deref for CompilerWorker {
- type Target = WebWorker;
- fn deref(&self) -> &Self::Target {
- &self.0
- }
-}
-
-impl DerefMut for CompilerWorker {
- fn deref_mut(&mut self) -> &mut Self::Target {
- &mut self.0
- }
-}
-
-impl Future for CompilerWorker {
- type Output = Result<(), ErrBox>;
-
- fn poll(self: Pin<&mut Self>, cx: &mut Context) -> Poll<Self::Output> {
- let inner = self.get_mut();
- inner.0.poll_unpin(cx)
- }
-}