Expand description
Module loader rooted at the script_root sandbox.
Scripts can import other JS files via ES module syntax:
import { helper } from './helpers.js';
import data from './fixtures/users.js';All import paths are:
- Resolved relative to the importing module’s directory (or the sandbox root for inline scripts with no base).
- Validated against the
PathSandboxjust likefs.readFile— absolute paths,..components, and symlink escapes are rejected. - Loaded from disk via rquickjs’s built-in
ScriptLoader(.jsby default;.mjsalso accepted).
Bare specifiers (e.g. import lodash from 'lodash') are rejected — there
is no node_modules resolution on purpose, the sandbox is self-contained.
Structs§
- Sandbox
Loader - Loader wrapper that accepts only paths the
SandboxResolverproduced. - Sandbox
Resolver - Path-sanitising resolver that maps ES module specifiers to absolute paths inside the sandbox root.