mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-30 12:11:56 +00:00
update deno (#2361)
This commit is contained in:
2141
backend/Cargo.lock
generated
2141
backend/Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
@@ -1041,7 +1041,14 @@ export const action = {
|
|||||||
|
|
||||||
async "test-disk-usage"(effects, _input) {
|
async "test-disk-usage"(effects, _input) {
|
||||||
const usage = await effects.diskUsage()
|
const usage = await effects.diskUsage()
|
||||||
return usage
|
return {
|
||||||
|
result: {
|
||||||
|
copyable: false,
|
||||||
|
message: `${usage.used} / ${usage.total}`,
|
||||||
|
version: "0",
|
||||||
|
qr: false,
|
||||||
|
},
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|||||||
1681
libs/Cargo.lock
generated
1681
libs/Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
@@ -2,6 +2,7 @@
|
|||||||
# Reason for this being is that we need to create a snapshot for the deno runtime. It wants to pull 3 files from build, and during the creation it gets embedded, but for some
|
# Reason for this being is that we need to create a snapshot for the deno runtime. It wants to pull 3 files from build, and during the creation it gets embedded, but for some
|
||||||
# reason during the actual runtime it is looking for them. So this will create a docker in arm that creates the snaphot needed for the arm
|
# reason during the actual runtime it is looking for them. So this will create a docker in arm that creates the snaphot needed for the arm
|
||||||
set -e
|
set -e
|
||||||
|
shopt -s expand_aliases
|
||||||
|
|
||||||
if [ "$0" != "./build-arm-v8-snapshot.sh" ]; then
|
if [ "$0" != "./build-arm-v8-snapshot.sh" ]; then
|
||||||
>&2 echo "Must be run from backend/workspace directory"
|
>&2 echo "Must be run from backend/workspace directory"
|
||||||
@@ -13,9 +14,11 @@ if tty -s; then
|
|||||||
USE_TTY="-it"
|
USE_TTY="-it"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
alias 'rust-gnu-builder'='docker run $USE_TTY --rm -v "$HOME/.cargo/registry":/usr/local/cargo/registry -v "$(pwd)":/home/rust/src -w /home/rust/src -P start9/rust-arm-cross:aarch64'
|
||||||
|
|
||||||
echo "Building "
|
echo "Building "
|
||||||
cd ..
|
cd ..
|
||||||
docker run --rm $USE_TTY -v "$HOME/.cargo/registry":/root/.cargo/registry -v "$(pwd)":/home/rust/src start9/rust-arm-cross:aarch64 sh -c "(cd libs/ && cargo build -p snapshot_creator --release )"
|
rust-gnu-builder sh -c "(cd libs/ && cargo build -p snapshot_creator --release --target=aarch64-unknown-linux-gnu)"
|
||||||
cd -
|
cd -
|
||||||
|
|
||||||
echo "Creating Arm v8 Snapshot"
|
echo "Creating Arm v8 Snapshot"
|
||||||
|
|||||||
@@ -8,35 +8,13 @@ edition = "2021"
|
|||||||
[dependencies]
|
[dependencies]
|
||||||
async-trait = "0.1.56"
|
async-trait = "0.1.56"
|
||||||
dashmap = "5.3.4"
|
dashmap = "5.3.4"
|
||||||
deno_core = "=0.136.0"
|
deno_core = "0.195.0"
|
||||||
deno_ast = { version = "=0.15.0", features = ["transpiling"] }
|
deno_ast = { version = "0.27.2", features = ["transpiling"] }
|
||||||
dprint-swc-ext = "=0.1.1"
|
|
||||||
embassy_container_init = { path = "../embassy_container_init" }
|
embassy_container_init = { path = "../embassy_container_init" }
|
||||||
reqwest = { version = "0.11.11" }
|
reqwest = { version = "0.11.11" }
|
||||||
swc_atoms = "=0.2.11"
|
|
||||||
swc_common = "=0.18.7"
|
|
||||||
swc_config = "=0.1.1"
|
|
||||||
swc_config_macro = "=0.1.0"
|
|
||||||
swc_ecma_ast = "=0.78.1"
|
|
||||||
swc_ecma_codegen = "=0.108.6"
|
|
||||||
swc_ecma_codegen_macros = "=0.7.0"
|
|
||||||
swc_ecma_parser = "=0.104.2"
|
|
||||||
swc_ecma_transforms = "=0.154.0"
|
|
||||||
swc_ecma_transforms_base = "=0.85.4"
|
|
||||||
swc_ecma_transforms_classes = "=0.73.0"
|
|
||||||
swc_ecma_transforms_macros = "=0.3.0"
|
|
||||||
swc_ecma_transforms_proposal = "=0.107.0"
|
|
||||||
swc_ecma_transforms_react = "=0.114.1"
|
|
||||||
swc_ecma_transforms_typescript = "=0.117.2"
|
|
||||||
swc_ecma_utils = "=0.85.1"
|
|
||||||
swc_ecma_visit = "=0.64.0"
|
|
||||||
swc_ecmascript = "=0.157.0"
|
|
||||||
swc_eq_ignore_macros = "=0.1.0"
|
|
||||||
swc_macros_common = "=0.3.5"
|
|
||||||
swc_visit = "=0.3.0"
|
|
||||||
swc_visit_macros = "=0.3.1"
|
|
||||||
sha2 = "0.10.2"
|
sha2 = "0.10.2"
|
||||||
itertools = "0.10.5"
|
itertools = "0.10.5"
|
||||||
|
lazy_static = "1.4.0"
|
||||||
models = { path = "../models" }
|
models = { path = "../models" }
|
||||||
helpers = { path = "../helpers" }
|
helpers = { path = "../helpers" }
|
||||||
serde = { version = "1.0", features = ["derive", "rc"] }
|
serde = { version = "1.0", features = ["derive", "rc"] }
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
@@ -94,7 +94,7 @@ const metadata = async (
|
|||||||
const removeFile = (
|
const removeFile = (
|
||||||
{ volumeId = requireParam("volumeId"), path = requireParam("path") } = requireParam("options"),
|
{ volumeId = requireParam("volumeId"), path = requireParam("path") } = requireParam("options"),
|
||||||
) => Deno.core.opAsync("remove_file", volumeId, path);
|
) => Deno.core.opAsync("remove_file", volumeId, path);
|
||||||
const isSandboxed = () => Deno.core.opSync("is_sandboxed");
|
const isSandboxed = () => Deno.core.ops["is_sandboxed"]();
|
||||||
|
|
||||||
const writeJsonFile = (
|
const writeJsonFile = (
|
||||||
{
|
{
|
||||||
@@ -193,10 +193,10 @@ const diskUsage = async ({
|
|||||||
return { used, total }
|
return { used, total }
|
||||||
}
|
}
|
||||||
|
|
||||||
const currentFunction = Deno.core.opSync("current_function");
|
const currentFunction = Deno.core.ops.current_function();
|
||||||
const input = Deno.core.opSync("get_input");
|
const input = Deno.core.ops.get_input();
|
||||||
const variable_args = Deno.core.opSync("get_variable_args");
|
const variable_args = Deno.core.ops.get_variable_args();
|
||||||
const setState = (x) => Deno.core.opSync("set_value", x);
|
const setState = (x) => Deno.core.ops.set_value(x);
|
||||||
const effects = {
|
const effects = {
|
||||||
chmod,
|
chmod,
|
||||||
chown,
|
chown,
|
||||||
|
|||||||
@@ -7,8 +7,9 @@ use std::time::SystemTime;
|
|||||||
use deno_core::anyhow::{anyhow, bail};
|
use deno_core::anyhow::{anyhow, bail};
|
||||||
use deno_core::error::AnyError;
|
use deno_core::error::AnyError;
|
||||||
use deno_core::{
|
use deno_core::{
|
||||||
resolve_import, Extension, JsRuntime, ModuleLoader, ModuleSource, ModuleSourceFuture,
|
resolve_import, Extension, FastString, JsRuntime, ModuleLoader, ModuleSource,
|
||||||
ModuleSpecifier, ModuleType, OpDecl, RuntimeOptions, Snapshot,
|
ModuleSourceFuture, ModuleSpecifier, ModuleType, OpDecl, ResolutionKind, RuntimeOptions,
|
||||||
|
Snapshot,
|
||||||
};
|
};
|
||||||
use embassy_container_init::ProcessGroupId;
|
use embassy_container_init::ProcessGroupId;
|
||||||
use helpers::{script_dir, spawn_local, Rsync, UnixRpcClient};
|
use helpers::{script_dir, spawn_local, Rsync, UnixRpcClient};
|
||||||
@@ -18,6 +19,12 @@ use serde_json::Value;
|
|||||||
use tokio::io::AsyncReadExt;
|
use tokio::io::AsyncReadExt;
|
||||||
use tokio::sync::Mutex;
|
use tokio::sync::Mutex;
|
||||||
|
|
||||||
|
lazy_static::lazy_static! {
|
||||||
|
static ref DENO_GLOBAL_JS: ModuleSpecifier = "file:///deno_global.js".parse().unwrap();
|
||||||
|
static ref LOAD_MODULE_JS: ModuleSpecifier = "file:///loadModule.js".parse().unwrap();
|
||||||
|
static ref EMBASSY_JS: ModuleSpecifier = "file:///embassy.js".parse().unwrap();
|
||||||
|
}
|
||||||
|
|
||||||
pub trait PathForVolumeId: Send + Sync {
|
pub trait PathForVolumeId: Send + Sync {
|
||||||
fn path_for(
|
fn path_for(
|
||||||
&self,
|
&self,
|
||||||
@@ -29,8 +36,8 @@ pub trait PathForVolumeId: Send + Sync {
|
|||||||
fn readonly(&self, volume_id: &VolumeId) -> bool;
|
fn readonly(&self, volume_id: &VolumeId) -> bool;
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Debug, Default, Clone)]
|
#[derive(Serialize, Deserialize, Debug, Clone)]
|
||||||
pub struct JsCode(String);
|
pub struct JsCode(Arc<str>);
|
||||||
|
|
||||||
#[derive(Debug, Clone, Copy)]
|
#[derive(Debug, Clone, Copy)]
|
||||||
pub enum JsError {
|
pub enum JsError {
|
||||||
@@ -118,7 +125,7 @@ impl ModuleLoader for ModsLoader {
|
|||||||
&self,
|
&self,
|
||||||
specifier: &str,
|
specifier: &str,
|
||||||
referrer: &str,
|
referrer: &str,
|
||||||
_is_main: bool,
|
_is_main: ResolutionKind,
|
||||||
) -> Result<ModuleSpecifier, AnyError> {
|
) -> Result<ModuleSpecifier, AnyError> {
|
||||||
if referrer.contains("embassy") {
|
if referrer.contains("embassy") {
|
||||||
bail!("Embassy.js cannot import anything else");
|
bail!("Embassy.js cannot import anything else");
|
||||||
@@ -130,38 +137,30 @@ impl ModuleLoader for ModsLoader {
|
|||||||
fn load(
|
fn load(
|
||||||
&self,
|
&self,
|
||||||
module_specifier: &ModuleSpecifier,
|
module_specifier: &ModuleSpecifier,
|
||||||
maybe_referrer: Option<ModuleSpecifier>,
|
maybe_referrer: Option<&ModuleSpecifier>,
|
||||||
is_dyn_import: bool,
|
is_dyn_import: bool,
|
||||||
) -> Pin<Box<ModuleSourceFuture>> {
|
) -> Pin<Box<ModuleSourceFuture>> {
|
||||||
let module_specifier = module_specifier.as_str().to_owned();
|
let module_specifier = module_specifier.as_str().to_owned();
|
||||||
let module = match &*module_specifier {
|
let module = match &*module_specifier {
|
||||||
"file:///deno_global.js" => Ok(ModuleSource {
|
"file:///deno_global.js" => Ok(ModuleSource::new(
|
||||||
module_url_specified: "file:///deno_global.js".to_string(),
|
ModuleType::JavaScript,
|
||||||
module_url_found: "file:///deno_global.js".to_string(),
|
FastString::Static("const old_deno = Deno; Deno = null; export default old_deno"),
|
||||||
code: "const old_deno = Deno; Deno = null; export default old_deno"
|
&*DENO_GLOBAL_JS,
|
||||||
.as_bytes()
|
)),
|
||||||
.to_vec()
|
"file:///loadModule.js" => Ok(ModuleSource::new(
|
||||||
.into_boxed_slice(),
|
ModuleType::JavaScript,
|
||||||
module_type: ModuleType::JavaScript,
|
FastString::Static(include_str!("./artifacts/loadModule.js")),
|
||||||
}),
|
&*LOAD_MODULE_JS,
|
||||||
"file:///loadModule.js" => Ok(ModuleSource {
|
)),
|
||||||
module_url_specified: "file:///loadModule.js".to_string(),
|
"file:///embassy.js" => Ok(ModuleSource::new(
|
||||||
module_url_found: "file:///loadModule.js".to_string(),
|
ModuleType::JavaScript,
|
||||||
code: include_str!("./artifacts/loadModule.js")
|
self.code.0.clone().into(),
|
||||||
.as_bytes()
|
&*EMBASSY_JS,
|
||||||
.to_vec()
|
)),
|
||||||
.into_boxed_slice(),
|
|
||||||
module_type: ModuleType::JavaScript,
|
|
||||||
}),
|
|
||||||
"file:///embassy.js" => Ok(ModuleSource {
|
|
||||||
module_url_specified: "file:///embassy.js".to_string(),
|
|
||||||
module_url_found: "file:///embassy.js".to_string(),
|
|
||||||
code: self.code.0.as_bytes().to_vec().into_boxed_slice(),
|
|
||||||
module_type: ModuleType::JavaScript,
|
|
||||||
}),
|
|
||||||
x => Err(anyhow!("Not allowed to import: {}", x)),
|
x => Err(anyhow!("Not allowed to import: {}", x)),
|
||||||
};
|
};
|
||||||
Box::pin(async move {
|
let module = module.and_then(|m| {
|
||||||
if is_dyn_import {
|
if is_dyn_import {
|
||||||
bail!("Will not import dynamic");
|
bail!("Will not import dynamic");
|
||||||
}
|
}
|
||||||
@@ -171,8 +170,9 @@ impl ModuleLoader for ModsLoader {
|
|||||||
}
|
}
|
||||||
_ => (),
|
_ => (),
|
||||||
}
|
}
|
||||||
module
|
Ok(m)
|
||||||
})
|
});
|
||||||
|
Box::pin(async move { module })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -219,7 +219,7 @@ impl JsExecutionEnvironment {
|
|||||||
format!("The file reading created error: {}", err),
|
format!("The file reading created error: {}", err),
|
||||||
));
|
));
|
||||||
};
|
};
|
||||||
buffer
|
buffer.into()
|
||||||
});
|
});
|
||||||
Ok(JsExecutionEnvironment {
|
Ok(JsExecutionEnvironment {
|
||||||
base_directory: base_directory.to_owned(),
|
base_directory: base_directory.to_owned(),
|
||||||
@@ -336,12 +336,11 @@ impl JsExecutionEnvironment {
|
|||||||
container_rpc_client: self.container_rpc_client.clone(),
|
container_rpc_client: self.container_rpc_client.clone(),
|
||||||
rsyncs: Default::default(),
|
rsyncs: Default::default(),
|
||||||
};
|
};
|
||||||
let ext = Extension::builder()
|
let ext = Extension::builder("embassy")
|
||||||
.ops(Self::declarations())
|
.ops(Self::declarations())
|
||||||
.state(move |state| {
|
.state(move |state| {
|
||||||
state.put(ext_answer_state.clone());
|
state.put(ext_answer_state.clone());
|
||||||
state.put(js_ctx.clone());
|
state.put(js_ctx.clone());
|
||||||
Ok(())
|
|
||||||
})
|
})
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
|||||||
@@ -7,5 +7,5 @@ edition = "2021"
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
dashmap = "5.3.4"
|
dashmap = "5.3.4"
|
||||||
deno_core = "=0.136.0"
|
deno_core = "0.195.0"
|
||||||
deno_ast = { version = "=0.15.0", features = ["transpiling"] }
|
deno_ast = { version = "0.27.2", features = ["transpiling"] }
|
||||||
|
|||||||
@@ -1,10 +1,7 @@
|
|||||||
use deno_core::{JsRuntime, RuntimeOptions};
|
use deno_core::JsRuntimeForSnapshot;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let mut runtime = JsRuntime::new(RuntimeOptions {
|
let runtime = JsRuntimeForSnapshot::new(Default::default(), Default::default());
|
||||||
will_snapshot: true,
|
|
||||||
..Default::default()
|
|
||||||
});
|
|
||||||
let snapshot = runtime.snapshot();
|
let snapshot = runtime.snapshot();
|
||||||
|
|
||||||
let snapshot_slice: &[u8] = &*snapshot;
|
let snapshot_slice: &[u8] = &*snapshot;
|
||||||
|
|||||||
Reference in New Issue
Block a user