Files
windmill/backend/windmill-worker/build.rs
Ruben Fiszel 5207a7a6aa feat: eval v2, blazing fast eval triggered only upon the right changes (#2164)
* progress

* progress

* progress

* add suggestions to frontend scripts

* all eval

* remove onlyStatic

* handle better conversions

* handle better conversions

* remove variable picker

* fix pen positioning

* fix v1
2023-08-23 19:50:35 +02:00

76 lines
2.0 KiB
Rust

use deno_core::OpState;
use deno_fetch::FetchPermissions;
use deno_web::{BlobStore, TimersPermission};
use std::env;
use std::path::PathBuf;
use std::sync::Arc;
pub struct PermissionsContainer;
impl FetchPermissions for PermissionsContainer {
fn check_net_url(
&mut self,
_url: &deno_core::url::Url,
_api_name: &str,
) -> Result<(), deno_core::error::AnyError> {
Ok(())
}
fn check_read(
&mut self,
_p: &std::path::Path,
_api_name: &str,
) -> Result<(), deno_core::error::AnyError> {
Ok(())
}
}
impl TimersPermission for PermissionsContainer {
fn allow_hrtime(&mut self) -> bool {
true
}
fn check_unstable(&self, _state: &OpState, _api_name: &'static str) {
()
}
}
deno_core::extension!(
fetch,
esm_entry_point = "ext:fetch/src/runtime.js",
esm = ["src/runtime.js"],
);
fn main() {
println!("cargo:rustc-env=TARGET={}", env::var("TARGET").unwrap());
println!("cargo:rustc-env=PROFILE={}", env::var("PROFILE").unwrap());
let exts = vec![
deno_webidl::deno_webidl::init_ops_and_esm(),
deno_url::deno_url::init_ops_and_esm(),
deno_console::deno_console::init_ops_and_esm(),
deno_web::deno_web::init_ops_and_esm::<PermissionsContainer>(
Arc::new(BlobStore::default()),
None,
),
deno_fetch::deno_fetch::init_ops_and_esm::<PermissionsContainer>(Default::default()),
fetch::init_ops_and_esm(),
];
// Build the file path to the snapshot.
let o = PathBuf::from(env::var_os("OUT_DIR").unwrap());
let snapshot_path = o.join("FETCH_SNAPSHOT.bin");
// Create the snapshot.
let _ = deno_core::snapshot_util::create_snapshot(
deno_core::snapshot_util::CreateSnapshotOptions {
cargo_manifest_dir: env!("CARGO_MANIFEST_DIR"),
snapshot_path: snapshot_path,
startup_snapshot: None,
extensions: exts,
compression_cb: None,
with_runtime_cb: None,
},
);
}