sandboxedjs 0.1.28 → 0.1.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -7
- package/README.md +104 -7
- package/dist/index.cjs +1014 -53
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +321 -8
- package/dist/index.d.ts +321 -8
- package/dist/index.js +1010 -54
- package/dist/index.js.map +1 -1
- package/dist/service-worker.js +112 -0
- package/dist/service-worker.js.map +1 -0
- package/dist/worker-entry.js +30825 -0
- package/dist/worker-entry.js.map +1 -0
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -25,9 +25,41 @@ interface ChildSpawnConfig {
|
|
|
25
25
|
cwd?: string;
|
|
26
26
|
env?: Record<string, string>;
|
|
27
27
|
parentPid?: number;
|
|
28
|
+
/**
|
|
29
|
+
* The child was given the parent's streams (`stdio: "inherit"`).
|
|
30
|
+
*
|
|
31
|
+
* Its input is then the parent's terminal rather than a pipe that will end,
|
|
32
|
+
* which is the difference between a program that waits for what the user
|
|
33
|
+
* types and one that reads to end-of-input and stops.
|
|
34
|
+
*/
|
|
35
|
+
inheritStdio?: boolean;
|
|
28
36
|
}
|
|
29
37
|
type SpawnChild = (config: ChildSpawnConfig) => ChildHandle;
|
|
30
|
-
|
|
38
|
+
/**
|
|
39
|
+
* Run a child to completion without returning to the event loop.
|
|
40
|
+
*
|
|
41
|
+
* Supplied only by a pod that can actually block — one whose guest runs on its
|
|
42
|
+
* own thread. Where it is absent the synchronous entry points keep reporting
|
|
43
|
+
* that they are unavailable, which is the honest answer for an in-realm pod.
|
|
44
|
+
*/
|
|
45
|
+
type SyncSpawn = (request: {
|
|
46
|
+
command: string;
|
|
47
|
+
args: string[];
|
|
48
|
+
cwd: string;
|
|
49
|
+
env?: Record<string, string>;
|
|
50
|
+
input?: string;
|
|
51
|
+
inheritStdio?: boolean;
|
|
52
|
+
}) => {
|
|
53
|
+
status: number | null;
|
|
54
|
+
stdout: string;
|
|
55
|
+
stderr: string;
|
|
56
|
+
signal: string | null;
|
|
57
|
+
error?: {
|
|
58
|
+
code?: string;
|
|
59
|
+
message: string;
|
|
60
|
+
};
|
|
61
|
+
};
|
|
62
|
+
declare function createChildProcessModule(spawnChild: SpawnChild, defaultCwd: () => string, syncSpawn?: SyncSpawn, defaultEnv?: () => Record<string, string>): Record<string, unknown>;
|
|
31
63
|
|
|
32
64
|
/**
|
|
33
65
|
* Clean-room contracts between SandboxedJS and its JavaScript runtime.
|
|
@@ -1639,6 +1671,24 @@ interface ContainerOptions {
|
|
|
1639
1671
|
* ```
|
|
1640
1672
|
*/
|
|
1641
1673
|
pod?: RuntimePod;
|
|
1674
|
+
/**
|
|
1675
|
+
* Where guest programs run.
|
|
1676
|
+
*
|
|
1677
|
+
* `"worker"` (the default) gives each program its own thread, which is what
|
|
1678
|
+
* makes synchronous child processes work and keeps guest code out of the
|
|
1679
|
+
* host's realm; it falls back automatically where the host cannot support it.
|
|
1680
|
+
* `"realm"` forces the in-realm runtime.
|
|
1681
|
+
*/
|
|
1682
|
+
isolation?: "worker" | "realm";
|
|
1683
|
+
/**
|
|
1684
|
+
* Where to load the guest worker bundle from.
|
|
1685
|
+
*
|
|
1686
|
+
* Defaults to the copy shipped beside the main bundle, which is what a
|
|
1687
|
+
* published package wants. Worth setting when a bundler has moved or
|
|
1688
|
+
* rewritten it — or when running from source, where the built file is the
|
|
1689
|
+
* only one a Worker can load.
|
|
1690
|
+
*/
|
|
1691
|
+
workerUrl?: string | URL;
|
|
1642
1692
|
/** Python runtime settings; a browser host uses this to locate the wasm. */
|
|
1643
1693
|
python?: PythonOptions;
|
|
1644
1694
|
}
|
|
@@ -2457,6 +2507,14 @@ interface CoreModulesOptions {
|
|
|
2457
2507
|
};
|
|
2458
2508
|
/** Backs `child_process`; without it the module reports as unavailable. */
|
|
2459
2509
|
spawnChild?: SpawnChild;
|
|
2510
|
+
/**
|
|
2511
|
+
* Backs the `*Sync` half of `child_process`.
|
|
2512
|
+
*
|
|
2513
|
+
* Only a pod whose guest runs on its own thread can supply this — blocking
|
|
2514
|
+
* requires somewhere else for the child's work to happen. Without it the
|
|
2515
|
+
* synchronous entry points keep reporting that they are unavailable.
|
|
2516
|
+
*/
|
|
2517
|
+
syncSpawn?: SyncSpawn;
|
|
2460
2518
|
/** File holding the process's standard input, exposed as descriptor 0. */
|
|
2461
2519
|
stdinPath?: string;
|
|
2462
2520
|
/** Keep `process.stdin` open and fed by {@link writeStdin} rather than ending it. */
|
|
@@ -2496,6 +2554,13 @@ declare function createCoreModules(options: CoreModulesOptions): {
|
|
|
2496
2554
|
pendingHandles(): number;
|
|
2497
2555
|
/** Active timers which called `unref()` and therefore only merit startup grace. */
|
|
2498
2556
|
pendingUnrefed(): number;
|
|
2557
|
+
/**
|
|
2558
|
+
* Cancel every timer this process still holds.
|
|
2559
|
+
*
|
|
2560
|
+
* Called when a process is killed: the process is finished, but its
|
|
2561
|
+
* scheduled work would otherwise keep running on the host's event loop.
|
|
2562
|
+
*/
|
|
2563
|
+
cancelTimers(): void;
|
|
2499
2564
|
/**
|
|
2500
2565
|
* Client requests sent but not yet read to completion.
|
|
2501
2566
|
*
|
|
@@ -2533,6 +2598,99 @@ declare function looksLikeEsm(source: string): boolean;
|
|
|
2533
2598
|
*/
|
|
2534
2599
|
declare function transformEsm(source: string, filename?: string): EsmTransformResult | null;
|
|
2535
2600
|
|
|
2601
|
+
/**
|
|
2602
|
+
* A volume that keeps a second, foreign filesystem in step with itself.
|
|
2603
|
+
*
|
|
2604
|
+
* Rolldown's browser WebAssembly binding owns a `memfs` volume of its own —
|
|
2605
|
+
* its Rust resolver reads through WASI, not through anything JavaScript can
|
|
2606
|
+
* hand it. So the sandbox project has to exist in two places at once, and the
|
|
2607
|
+
* copy has to stay current: a dev server reads `index.html` when the request
|
|
2608
|
+
* arrives, not when the process started.
|
|
2609
|
+
*
|
|
2610
|
+
* Mirroring on write rather than copying up-front is what makes that true. The
|
|
2611
|
+
* previous approach took one deep snapshot per spawn, which was both expensive
|
|
2612
|
+
* — every `npm run dev` re-copied `node_modules` — and already stale by the
|
|
2613
|
+
* time it mattered, so an edit during a session was served from the old tree.
|
|
2614
|
+
*
|
|
2615
|
+
* The mirror is deliberately one-way and best-effort. It is a cache for a
|
|
2616
|
+
* consumer that only reads; a write that fails to reach it must never fail the
|
|
2617
|
+
* write that the container itself made.
|
|
2618
|
+
*/
|
|
2619
|
+
|
|
2620
|
+
/** The slice of a `memfs`-style filesystem the mirror writes through. */
|
|
2621
|
+
interface MirrorFs {
|
|
2622
|
+
mkdirSync(path: string, options?: {
|
|
2623
|
+
recursive?: boolean;
|
|
2624
|
+
}): void;
|
|
2625
|
+
writeFileSync(path: string, data: Uint8Array): void;
|
|
2626
|
+
symlinkSync(target: string, path: string): void;
|
|
2627
|
+
rmSync?(path: string, options?: {
|
|
2628
|
+
recursive?: boolean;
|
|
2629
|
+
force?: boolean;
|
|
2630
|
+
}): void;
|
|
2631
|
+
unlinkSync?(path: string): void;
|
|
2632
|
+
rmdirSync?(path: string): void;
|
|
2633
|
+
}
|
|
2634
|
+
/**
|
|
2635
|
+
* A `RuntimeVolume` that forwards every mutation to an optional mirror.
|
|
2636
|
+
*
|
|
2637
|
+
* Wrapping rather than modifying `MemoryVolume` keeps the mirroring concern out
|
|
2638
|
+
* of the filesystem, and keeps this transparent to the kernel, whose `Vfs`
|
|
2639
|
+
* takes any `RuntimeVolume`.
|
|
2640
|
+
*/
|
|
2641
|
+
declare class MirroringVolume implements RuntimeVolume {
|
|
2642
|
+
private readonly inner;
|
|
2643
|
+
private mirror;
|
|
2644
|
+
private root;
|
|
2645
|
+
constructor(inner?: MemoryVolume);
|
|
2646
|
+
/**
|
|
2647
|
+
* Start mirroring the tree under `root`, seeding it with what is there now.
|
|
2648
|
+
*
|
|
2649
|
+
* Called once the Rolldown binding is known to be in play; before that a
|
|
2650
|
+
* container pays nothing for this.
|
|
2651
|
+
*/
|
|
2652
|
+
attach(mirror: MirrorFs, root: string): void;
|
|
2653
|
+
detach(): void;
|
|
2654
|
+
/** Copy the whole subtree across. The only bulk operation that remains. */
|
|
2655
|
+
private seed;
|
|
2656
|
+
/** Is this path inside the mirrored subtree? */
|
|
2657
|
+
private mirrored;
|
|
2658
|
+
/**
|
|
2659
|
+
* Run a mirror update, swallowing failure.
|
|
2660
|
+
*
|
|
2661
|
+
* The mirror is a read-only cache for another engine. If it rejects
|
|
2662
|
+
* something — an unsupported operation, a path it has not seen — the
|
|
2663
|
+
* container's own write has still happened and must still succeed.
|
|
2664
|
+
*/
|
|
2665
|
+
private safely;
|
|
2666
|
+
/** Push a path's current state across, whatever it is now. */
|
|
2667
|
+
private sync;
|
|
2668
|
+
readFileSync(path: string): Uint8Array;
|
|
2669
|
+
readdirSync(path: string): string[];
|
|
2670
|
+
lstatSync(path: string): VolumeStat;
|
|
2671
|
+
readlinkSync(path: string): string;
|
|
2672
|
+
getStats(): VolumeStats;
|
|
2673
|
+
writeFileSync(path: string, data: string | Uint8Array): void;
|
|
2674
|
+
appendFileSync(path: string, data: string | Uint8Array): void;
|
|
2675
|
+
mkdirSync(path: string, options?: {
|
|
2676
|
+
mode?: number;
|
|
2677
|
+
}): void;
|
|
2678
|
+
rmdirSync(path: string): void;
|
|
2679
|
+
unlinkSync(path: string): void;
|
|
2680
|
+
renameSync(from: string, to: string): void;
|
|
2681
|
+
symlinkSync(target: string, path: string): void;
|
|
2682
|
+
linkSync(existing: string, path: string): void;
|
|
2683
|
+
truncateSync(path: string, length?: number): void;
|
|
2684
|
+
chmodSync(path: string, mode: number): void;
|
|
2685
|
+
lchmodSync(path: string, mode: number): void;
|
|
2686
|
+
chownSync(path: string, uid: number, gid: number): void;
|
|
2687
|
+
lchownSync(path: string, uid: number, gid: number): void;
|
|
2688
|
+
utimesSync(path: string, atime: Date, mtime: Date): void;
|
|
2689
|
+
snapshot(): MemoryVolumeSnapshotEntry[];
|
|
2690
|
+
/** A restore replaces everything, so the mirror is rebuilt rather than patched. */
|
|
2691
|
+
restore(entries: MemoryVolumeSnapshotEntry[]): void;
|
|
2692
|
+
}
|
|
2693
|
+
|
|
2536
2694
|
interface LocalRuntimeOptions {
|
|
2537
2695
|
workdir?: string;
|
|
2538
2696
|
env?: Record<string, string>;
|
|
@@ -2569,10 +2727,10 @@ declare const WASM_ALIASES: Record<string, string>;
|
|
|
2569
2727
|
* dedicated Worker before this becomes the default untrusted-code path.
|
|
2570
2728
|
*/
|
|
2571
2729
|
declare class LocalRuntimePod implements RuntimePod {
|
|
2572
|
-
readonly volume:
|
|
2730
|
+
readonly volume: MirroringVolume;
|
|
2573
2731
|
readonly packages: RuntimePackageInstaller;
|
|
2574
2732
|
readonly instanceId: string;
|
|
2575
|
-
|
|
2733
|
+
protected readonly router: VirtualHttpRouter;
|
|
2576
2734
|
readonly proxy: {
|
|
2577
2735
|
activePorts: (_instanceId?: string) => number[];
|
|
2578
2736
|
};
|
|
@@ -2585,15 +2743,15 @@ declare class LocalRuntimePod implements RuntimePod {
|
|
|
2585
2743
|
spawn(config: ChildSpawnConfig): ChildHandle;
|
|
2586
2744
|
};
|
|
2587
2745
|
private disposed;
|
|
2588
|
-
|
|
2589
|
-
|
|
2590
|
-
|
|
2746
|
+
protected readonly workdir: string;
|
|
2747
|
+
protected readonly env: Record<string, string>;
|
|
2748
|
+
protected readonly aliases: Record<string, string>;
|
|
2591
2749
|
private readonly modules;
|
|
2592
2750
|
private readonly esbuild;
|
|
2593
2751
|
private rolldownBinding;
|
|
2594
2752
|
/** Backs outbound `http`/`https` client requests from inside the sandbox. */
|
|
2595
2753
|
private readonly fetch;
|
|
2596
|
-
|
|
2754
|
+
protected constructor(options: LocalRuntimeOptions);
|
|
2597
2755
|
static boot(options?: LocalRuntimeOptions): Promise<LocalRuntimePod>;
|
|
2598
2756
|
spawn(command: string, args?: string[], options?: Record<string, unknown>): Promise<RuntimeProcess>;
|
|
2599
2757
|
/**
|
|
@@ -2628,6 +2786,68 @@ declare class LocalRuntimePod implements RuntimePod {
|
|
|
2628
2786
|
private assertActive;
|
|
2629
2787
|
}
|
|
2630
2788
|
|
|
2789
|
+
/**
|
|
2790
|
+
* A pod that evaluates each guest program on its own thread.
|
|
2791
|
+
*
|
|
2792
|
+
* Everything shared stays here: the volume, the HTTP router, the package
|
|
2793
|
+
* installer and the process table. Only the program's own evaluation moves,
|
|
2794
|
+
* and it reaches back for the rest through a {@link SyncChannelServer}.
|
|
2795
|
+
*
|
|
2796
|
+
* That arrangement is forced rather than chosen. A synchronous call has to
|
|
2797
|
+
* block the caller while the work it is waiting on still makes progress, so
|
|
2798
|
+
* the blocking side cannot be the side that owns the resources — otherwise a
|
|
2799
|
+
* child process needing the filesystem would have to call into a thread that
|
|
2800
|
+
* is frozen waiting for that child. The guest blocks; the host never does.
|
|
2801
|
+
*
|
|
2802
|
+
* It inherits from {@link LocalRuntimePod} because every other part of the
|
|
2803
|
+
* contract is identical, and overriding one method is a smaller and more
|
|
2804
|
+
* honest claim than reimplementing nine. Both are held to the same contract
|
|
2805
|
+
* suite (`test/pod-contract.ts`).
|
|
2806
|
+
*/
|
|
2807
|
+
|
|
2808
|
+
interface WorkerRuntimeOptions extends LocalRuntimeOptions {
|
|
2809
|
+
/** Where the guest bundle lives; defaults to the copy shipped beside this one. */
|
|
2810
|
+
workerUrl?: string | URL;
|
|
2811
|
+
}
|
|
2812
|
+
declare class WorkerRuntimePod extends LocalRuntimePod {
|
|
2813
|
+
private readonly workerUrl;
|
|
2814
|
+
/** Live workers, so teardown can stop them all. */
|
|
2815
|
+
private readonly live;
|
|
2816
|
+
protected constructor(options: WorkerRuntimeOptions);
|
|
2817
|
+
/**
|
|
2818
|
+
* Boot a Worker-backed pod, or return null when this host cannot support one.
|
|
2819
|
+
*
|
|
2820
|
+
* Declining is a first-class outcome. `SharedArrayBuffer` needs cross-origin
|
|
2821
|
+
* isolation, a bundler may have made the guest script unreachable, and a host
|
|
2822
|
+
* that supplied its own module objects has handed over things no thread
|
|
2823
|
+
* boundary can carry. In every case the caller falls back to the in-realm pod
|
|
2824
|
+
* and keeps working.
|
|
2825
|
+
*/
|
|
2826
|
+
static tryBoot(options?: WorkerRuntimeOptions): Promise<WorkerRuntimePod | null>;
|
|
2827
|
+
spawn(command: string, args?: string[], options?: Record<string, unknown>): Promise<RuntimeProcess>;
|
|
2828
|
+
private spawnInWorker;
|
|
2829
|
+
/** Start an asynchronous child on the host's behalf and relay its events. */
|
|
2830
|
+
private startChild;
|
|
2831
|
+
/** Run a child to completion and collect it, for the guest's `spawnSync`. */
|
|
2832
|
+
private runChildToCompletion;
|
|
2833
|
+
private readonly proxies;
|
|
2834
|
+
private readonly waiting;
|
|
2835
|
+
private nextRequestId;
|
|
2836
|
+
/**
|
|
2837
|
+
* Register a stand-in for a server that is actually running in the Worker.
|
|
2838
|
+
*
|
|
2839
|
+
* The router only knows how to reach servers on this thread, so each bound
|
|
2840
|
+
* port gets a local server whose whole job is to forward and wait.
|
|
2841
|
+
*/
|
|
2842
|
+
private proxyPort;
|
|
2843
|
+
private forward;
|
|
2844
|
+
private settleProxied;
|
|
2845
|
+
private closeProxies;
|
|
2846
|
+
teardown(): void;
|
|
2847
|
+
/** Does anything under `cwd` need a module only the host can supply? */
|
|
2848
|
+
private needsHostModules;
|
|
2849
|
+
}
|
|
2850
|
+
|
|
2631
2851
|
interface RegistryManifest {
|
|
2632
2852
|
name: string;
|
|
2633
2853
|
version: string;
|
|
@@ -2678,6 +2898,99 @@ declare class CleanPackageInstaller implements RuntimePackageInstaller {
|
|
|
2678
2898
|
}
|
|
2679
2899
|
declare function extractNpmTarball(volume: RuntimeVolume, compressed: Uint8Array, destination: string): void;
|
|
2680
2900
|
|
|
2901
|
+
/**
|
|
2902
|
+
* Starting the guest Worker, in whichever environment the host happens to be.
|
|
2903
|
+
*
|
|
2904
|
+
* The awkward part of shipping a Worker from a library is not creating it, but
|
|
2905
|
+
* naming it. `new URL("./worker-entry.js", import.meta.url)` is the form every
|
|
2906
|
+
* bundler recognises, and it resolves correctly from `dist/` — but a bundler
|
|
2907
|
+
* that *pre-bundles* this package rewrites `import.meta.url` to point into its
|
|
2908
|
+
* own dependency cache, where no such file exists. That is the same trap
|
|
2909
|
+
* Rolldown's WASI binding falls into, and it surfaces just as obliquely.
|
|
2910
|
+
*
|
|
2911
|
+
* So this never assumes it worked. The caller treats a failure to start as
|
|
2912
|
+
* "this host cannot run the Worker pod" and uses the in-realm pod instead.
|
|
2913
|
+
*/
|
|
2914
|
+
interface RuntimeWorker {
|
|
2915
|
+
postMessage(message: unknown): void;
|
|
2916
|
+
onMessage(listener: (message: unknown) => void): void;
|
|
2917
|
+
onError(listener: (error: unknown) => void): void;
|
|
2918
|
+
terminate(): unknown;
|
|
2919
|
+
}
|
|
2920
|
+
/**
|
|
2921
|
+
* Start the guest Worker and wait for it to say it is alive.
|
|
2922
|
+
*
|
|
2923
|
+
* Rejects rather than hanging when the script cannot be loaded: a Worker whose
|
|
2924
|
+
* script 404s reports an `error` event and would otherwise leave the caller
|
|
2925
|
+
* waiting for a ready message that can never arrive.
|
|
2926
|
+
*/
|
|
2927
|
+
declare function startRuntimeWorker(options?: {
|
|
2928
|
+
url?: string | URL;
|
|
2929
|
+
workerData?: Record<string, unknown>;
|
|
2930
|
+
timeoutMs?: number;
|
|
2931
|
+
}): Promise<RuntimeWorker>;
|
|
2932
|
+
|
|
2933
|
+
/**
|
|
2934
|
+
* Can this environment support a blocking client at all?
|
|
2935
|
+
*
|
|
2936
|
+
* `SharedArrayBuffer` needs cross-origin isolation in a browser, and
|
|
2937
|
+
* `Atomics.wait` is forbidden on a browser's main thread — which is why the
|
|
2938
|
+
* client is always the Worker.
|
|
2939
|
+
*/
|
|
2940
|
+
declare function syncChannelSupported(): boolean;
|
|
2941
|
+
|
|
2942
|
+
/**
|
|
2943
|
+
* Wiring a container's HTTP servers up to real URLs in the page.
|
|
2944
|
+
*
|
|
2945
|
+
* The service worker does the routing; this is the half that lives in the page
|
|
2946
|
+
* and actually knows about the container.
|
|
2947
|
+
*
|
|
2948
|
+
* **Read the origin note before using this.** A preview served this way runs on
|
|
2949
|
+
* *your* origin, so scripts inside it can reach `window.parent`, your cookies
|
|
2950
|
+
* and your `localStorage` — the sandbox contains the program's *filesystem and
|
|
2951
|
+
* process table*, not the page it serves. For code you did not write, either
|
|
2952
|
+
* host the preview on a separate origin, or use {@link renderInto}, which puts
|
|
2953
|
+
* the response in an iframe with no origin at all.
|
|
2954
|
+
*/
|
|
2955
|
+
|
|
2956
|
+
interface PreviewOptions {
|
|
2957
|
+
/** Where the worker script lives; defaults to the copy shipped beside the bundle. */
|
|
2958
|
+
scriptUrl?: string | URL;
|
|
2959
|
+
/** Registration scope. Must be able to see the paths a preview will request. */
|
|
2960
|
+
scope?: string;
|
|
2961
|
+
}
|
|
2962
|
+
interface Preview {
|
|
2963
|
+
/** The URL an iframe should be pointed at to see `port`. */
|
|
2964
|
+
urlFor(port: number): string;
|
|
2965
|
+
/** Stop answering requests and unregister the worker. */
|
|
2966
|
+
dispose(): Promise<void>;
|
|
2967
|
+
}
|
|
2968
|
+
/**
|
|
2969
|
+
* Register the preview worker and start answering its requests from `box`.
|
|
2970
|
+
*
|
|
2971
|
+
* Resolves to null where service workers are unavailable — a non-secure origin,
|
|
2972
|
+
* a browser with them disabled, or any non-browser host. Callers should treat
|
|
2973
|
+
* that as "no preview URLs here" and fall back to `box.request`.
|
|
2974
|
+
*/
|
|
2975
|
+
declare function createPreview(box: Container, options?: PreviewOptions): Promise<Preview | null>;
|
|
2976
|
+
/**
|
|
2977
|
+
* Show one response from the container inside an element, without letting it
|
|
2978
|
+
* touch the page.
|
|
2979
|
+
*
|
|
2980
|
+
* The iframe is sandboxed with `allow-scripts` and deliberately *without*
|
|
2981
|
+
* `allow-same-origin`, which puts the document in an opaque origin: its scripts
|
|
2982
|
+
* run, and they can reach neither this page's DOM nor its cookies and storage.
|
|
2983
|
+
* That combination is what makes it safe to render output you do not trust.
|
|
2984
|
+
*
|
|
2985
|
+
* The trade-off is that only this one response exists — a page that asks for
|
|
2986
|
+
* `/main.js` gets nothing, because there is no origin to serve it from. For a
|
|
2987
|
+
* whole site, use {@link createPreview}, and read its note about origins first.
|
|
2988
|
+
*/
|
|
2989
|
+
declare function renderInto(box: Container, element: HTMLElement, options?: {
|
|
2990
|
+
port: number;
|
|
2991
|
+
path?: string;
|
|
2992
|
+
}): Promise<HTMLIFrameElement>;
|
|
2993
|
+
|
|
2681
2994
|
/**
|
|
2682
2995
|
* sandboxedjs — a Linux-like container that runs entirely inside Node.js.
|
|
2683
2996
|
*
|
|
@@ -2696,4 +3009,4 @@ declare function extractNpmTarball(volume: RuntimeVolume, compressed: Uint8Array
|
|
|
2696
3009
|
* ```
|
|
2697
3010
|
*/
|
|
2698
3011
|
|
|
2699
|
-
export { ArithError, BufferSink, type CPythonOptions, CallbackSink, type ChildHandle, type ChildSpawnConfig, type CleanInstallerOptions, CleanPackageInstaller, type Command, CommandRegistry, CommonJsEngine, type CommonJsEngineOptions, type CommonJsModule, Container, ContainerFs, type ContainerOptions, type ContextInit, type CoreModulesOptions, type Cred, type DirEntry, ERRNO, type Env, type ErrnoCode, type EsmTransformResult, type ExecContext, type ExecOptions, type ExecResult, type FileData, FileInput, FileOutput, type GroupEntry, type HttpResponse, IncompleteInputError, type InputStream, type InstallOptions, type Job, KERNEL_NAME, KERNEL_RELEASE, Kernel, type KernelOptions, type ListeningPort, type LocalRuntimeOptions, LocalRuntimePod, MemoryVolume, type MountEntry, NODE_VERSION, NPM_VERSION, type NetInterface, type NetworkOptions, NetworkStack, NullInput, NullOutput, OS_RELEASE, type OutputStream, PYTHON_VERSION, type PasswdEntry, Pipe, Process, type ProcessKind, type ProcessOptions, type ProcessState, ProcessTable, type PythonOptions, ROOT_CRED, type ResolvedExecutable, type RootfsOptions, type RunOptions, type RunResult, type RuntimePackageInstaller, type RuntimePod, type RuntimeProcess, type RuntimeProcessManager, type RuntimeProcessResult, type RuntimeVolume, SIGNALS, SIGNAL_NAMES, Session, type SessionInit, type SessionResult, type SessionRunOptions, Shell, ShellExit, type ShellIO, type ShellInit, Lexer as ShellLexer, type ShellOptions, ShellSyntaxError, type SpawnChild, type SpawnHandle, Stats, type Stdio, SysError, TeeOutput, Terminal, type TerminalOptions, UserDatabase, Variables, Vfs, VirtualHttpRouter, VirtualHttpServer, VirtualIncomingMessage, type VirtualNode, type VirtualProvider, VirtualServerResponse, WASM_ALIASES, type WriteOptions, allCommands, applyChmod, braceExpand, buildRootfs, builtinNames, captureStdio, configureCPython, configurePython, createChildProcessModule, createContainer, createContext, createCoreModules, createContainer as default, defineCommand, evalArith, exitCodeForSignal, expandPrompt, expandWord, expandWords, extractNpmTarball, fnmatch, formatMode, getBuiltin, glob, globToRegex, hasMagic, installUserland, isBuiltinName, isCPythonAvailable, isPythonAvailable, isSysError, looksLikeEsm, makeCred, normalizeSignal, octalMode, parse as parseShell, parseUmask, path as posixPath, resetPidCounter, shellQuote, strerror, transformEsm, unameInfo };
|
|
3012
|
+
export { ArithError, BufferSink, type CPythonOptions, CallbackSink, type ChildHandle, type ChildSpawnConfig, type CleanInstallerOptions, CleanPackageInstaller, type Command, CommandRegistry, CommonJsEngine, type CommonJsEngineOptions, type CommonJsModule, Container, ContainerFs, type ContainerOptions, type ContextInit, type CoreModulesOptions, type Cred, type DirEntry, ERRNO, type Env, type ErrnoCode, type EsmTransformResult, type ExecContext, type ExecOptions, type ExecResult, type FileData, FileInput, FileOutput, type GroupEntry, type HttpResponse, IncompleteInputError, type InputStream, type InstallOptions, type Job, KERNEL_NAME, KERNEL_RELEASE, Kernel, type KernelOptions, type ListeningPort, type LocalRuntimeOptions, LocalRuntimePod, MemoryVolume, type MountEntry, NODE_VERSION, NPM_VERSION, type NetInterface, type NetworkOptions, NetworkStack, NullInput, NullOutput, OS_RELEASE, type OutputStream, PYTHON_VERSION, type PasswdEntry, Pipe, type Preview, type PreviewOptions, Process, type ProcessKind, type ProcessOptions, type ProcessState, ProcessTable, type PythonOptions, ROOT_CRED, type ResolvedExecutable, type RootfsOptions, type RunOptions, type RunResult, type RuntimePackageInstaller, type RuntimePod, type RuntimeProcess, type RuntimeProcessManager, type RuntimeProcessResult, type RuntimeVolume, SIGNALS, SIGNAL_NAMES, Session, type SessionInit, type SessionResult, type SessionRunOptions, Shell, ShellExit, type ShellIO, type ShellInit, Lexer as ShellLexer, type ShellOptions, ShellSyntaxError, type SpawnChild, type SpawnHandle, Stats, type Stdio, SysError, TeeOutput, Terminal, type TerminalOptions, UserDatabase, Variables, Vfs, VirtualHttpRouter, VirtualHttpServer, VirtualIncomingMessage, type VirtualNode, type VirtualProvider, VirtualServerResponse, WASM_ALIASES, type WorkerRuntimeOptions, WorkerRuntimePod, type WriteOptions, allCommands, applyChmod, braceExpand, buildRootfs, builtinNames, captureStdio, configureCPython, configurePython, createChildProcessModule, createContainer, createContext, createCoreModules, createPreview, createContainer as default, defineCommand, evalArith, exitCodeForSignal, expandPrompt, expandWord, expandWords, extractNpmTarball, fnmatch, formatMode, getBuiltin, glob, globToRegex, hasMagic, installUserland, isBuiltinName, isCPythonAvailable, isPythonAvailable, isSysError, looksLikeEsm, makeCred, normalizeSignal, octalMode, parse as parseShell, parseUmask, path as posixPath, renderInto, resetPidCounter, shellQuote, startRuntimeWorker, strerror, syncChannelSupported, transformEsm, unameInfo };
|