Skip to main content

hyperlight_js/sandbox/
mod.rs

1/*
2Copyright 2026  The Hyperlight Authors.
3
4Licensed under the Apache License, Version 2.0 (the "License");
5you may not use this file except in compliance with the License.
6You may obtain a copy of the License at
7
8    http://www.apache.org/licenses/LICENSE-2.0
9
10Unless required by applicable law or agreed to in writing, software
11distributed under the License is distributed on an "AS IS" BASIS,
12WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13See the License for the specific language governing permissions and
14limitations under the License.
15*/
16//! The `sandbox` module contains the sandbox types for the Hyperlight JavaScript runtime.
17use std::env;
18/// Execution statistics captured after each guest function call.
19#[cfg(feature = "guest-call-stats")]
20pub mod execution_stats;
21/// Definition of a host function that can be called from guest JavaScript code.
22pub(crate) mod host_fn;
23/// A Hyperlight Sandbox with a JavaScript run time loaded but no guest code.
24pub(crate) mod js_sandbox;
25/// A Hyperlight Sandbox with a JavaScript run time loaded and guest code loaded.
26pub(crate) mod loaded_js_sandbox;
27/// Metric definitions for Sandbox module.
28pub(crate) mod metrics;
29/// Execution monitoring and enforcement (timeouts, resource limits, etc.).
30pub mod monitor;
31/// A Hyperlight Sandbox with no JavaScript run time loaded and no guest code.
32/// This is used to register new host functions prior to loading the JavaScript runtime.
33pub(crate) mod proto_js_sandbox;
34/// A builder for creating a new `JSSandbox`
35pub(crate) mod sandbox_builder;
36// This include! macro is replaced by the build.rs script.
37// The build.rs script reads the hyperlight-js-runtime binary into a static byte array named JSRUNTIME.
38include!(concat!(env!("OUT_DIR"), "/host_resource.rs"));