mirror of
https://github.com/denoland/deno.git
synced 2025-08-03 18:38:33 +00:00
feat: denort binary (#9041)
This commit adds new binary target called "denort". It is a "lite" version of "deno" binary that can only execute code embedded inside the binary itself. Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
This commit is contained in:
parent
e61e81eb57
commit
a44349dfdf
22 changed files with 315 additions and 258 deletions
|
@ -1,6 +1,5 @@
|
|||
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
|
||||
|
||||
use crate::version;
|
||||
use deno_core::error::generic_error;
|
||||
use deno_core::error::AnyError;
|
||||
use deno_core::url::Url;
|
||||
|
@ -15,10 +14,6 @@ use deno_runtime::deno_fetch::reqwest::Client;
|
|||
use deno_runtime::deno_fetch::reqwest::StatusCode;
|
||||
use std::collections::HashMap;
|
||||
|
||||
pub fn get_user_agent() -> String {
|
||||
format!("Deno/{}", version::deno())
|
||||
}
|
||||
|
||||
/// Create new instance of async reqwest::Client. This client supports
|
||||
/// proxies and doesn't follow redirects.
|
||||
pub fn create_http_client(
|
||||
|
@ -155,6 +150,7 @@ pub async fn fetch_once(
|
|||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use crate::version;
|
||||
use std::fs::read;
|
||||
|
||||
fn create_test_client(ca_data: Option<Vec<u8>>) -> Client {
|
||||
|
@ -313,7 +309,7 @@ mod tests {
|
|||
Url::parse("https://localhost:5545/cli/tests/fixture.json").unwrap();
|
||||
|
||||
let client = create_http_client(
|
||||
get_user_agent(),
|
||||
version::get_user_agent(),
|
||||
Some(
|
||||
read(
|
||||
test_util::root_path()
|
||||
|
@ -345,7 +341,7 @@ mod tests {
|
|||
)
|
||||
.unwrap();
|
||||
let client = create_http_client(
|
||||
get_user_agent(),
|
||||
version::get_user_agent(),
|
||||
Some(
|
||||
read(
|
||||
test_util::root_path()
|
||||
|
@ -376,7 +372,7 @@ mod tests {
|
|||
let _http_server_guard = test_util::http_server();
|
||||
let url = Url::parse("https://localhost:5545/etag_script.ts").unwrap();
|
||||
let client = create_http_client(
|
||||
get_user_agent(),
|
||||
version::get_user_agent(),
|
||||
Some(
|
||||
read(
|
||||
test_util::root_path()
|
||||
|
@ -416,7 +412,7 @@ mod tests {
|
|||
)
|
||||
.unwrap();
|
||||
let client = create_http_client(
|
||||
get_user_agent(),
|
||||
version::get_user_agent(),
|
||||
Some(
|
||||
read(
|
||||
test_util::root_path()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue