deno/cli/msg.rs

42 lines
997 B
Rust
Raw Normal View History

2020-01-02 20:13:47 +00:00
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
2018-11-30 03:03:00 +00:00
2019-08-26 21:02:34 +00:00
// Warning! The values in this enum are duplicated in js/compiler.ts
// Update carefully!
use serde::Serialize;
2019-08-26 21:02:34 +00:00
#[allow(non_camel_case_types)]
#[repr(i8)]
#[derive(Clone, Copy, PartialEq, Debug, Serialize)]
2019-08-26 21:02:34 +00:00
pub enum MediaType {
JavaScript = 0,
2019-10-02 14:46:36 +00:00
JSX = 1,
TypeScript = 2,
TSX = 3,
Json = 4,
Wasm = 5,
Unknown = 6,
2019-08-26 21:02:34 +00:00
}
pub fn enum_name_media_type(mt: MediaType) -> &'static str {
match mt {
MediaType::JavaScript => "JavaScript",
2019-10-02 14:46:36 +00:00
MediaType::JSX => "JSX",
2019-08-26 21:02:34 +00:00
MediaType::TypeScript => "TypeScript",
2019-10-02 14:46:36 +00:00
MediaType::TSX => "TSX",
2019-08-26 21:02:34 +00:00
MediaType::Json => "Json",
MediaType::Wasm => "Wasm",
2019-08-26 21:02:34 +00:00
MediaType::Unknown => "Unknown",
}
}
// Warning! The values in this enum are duplicated in js/compiler.ts
// Update carefully!
#[allow(non_camel_case_types)]
#[repr(i8)]
#[derive(Clone, Copy, PartialEq, Debug)]
pub enum CompilerRequestType {
Compile = 0,
RuntimeCompile = 1,
RuntimeTranspile = 2,
}