sandboxedjs 0.1.81 → 0.1.85

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/dist/index.d.cts CHANGED
@@ -1,8 +1,8 @@
1
- import { S as Shell, a as ShellIO, b as Session, N as Node, c as Command, K as Kernel, E as ExecContext, O as OutputStream, C as Container, B as BinaryBackend, d as createContainer } from './container-LwAV9JTH.cjs';
2
- export { e as BinaryExecutionRegistry, f as BinaryInfo, g as BinaryRequest, h as BufferSink, i as CallbackSink, j as CommandRegistry, k as ContainerFs, l as ContainerOptions, m as ContextInit, n as Env, o as ExecOptions, p as ExecResult, q as ExecutionDecision, r as ExecutionTier, F as FileData, s as FileInput, t as FileOutput, G as GroupEntry, H as HttpResponse, I as InputStream, J as Job, u as KernelOptions, L as ListeningPort, M as MANIFEST_FORMAT, v as MANIFEST_SCHEMA_VERSION, w as MountEntry, x as NetInterface, y as NetworkOptions, z as NetworkStack, A as NullInput, D as NullOutput, P as PYTHON_VERSION, Q as PasswdEntry, R as Pipe, T as Preparation, U as PreparedBinary, V as Process, W as ProcessKind, X as ProcessOptions, Y as ProcessState, Z as ProcessTable, _ as PythonCapabilities, $ as PythonOptions, a0 as PythonProfile, a1 as PythonRuntimeManifest, a2 as ResolvedExecutable, a3 as RunOptions, a4 as RunResult, a5 as SessionInit, a6 as SessionResult, a7 as SessionRunOptions, a8 as ShellExit, a9 as ShellInit, aa as ShellOptions, ab as SpawnHandle, ac as Stdio, ad as TeeOutput, ae as UserDatabase, af as Variables, ag as WasmCommandArtifact, ah as WasmTranslator, ai as binaryDigest, aj as braceExpand, ak as captureStdio, al as configurePython, am as createContext, an as createTranslationBackend, ao as createWasmCompatibilityBackend, ap as defineCommand, aq as expandWord, ar as expandWords, as as inspectElf, at as installWasmCommands, au as isElfBinary, av as isPythonAvailable, aw as resetPidCounter, ax as shellQuote, ay as validateManifest } from './container-LwAV9JTH.cjs';
3
- import { V as Vfs, C as Cred, R as RuntimeVolume, a as VirtualTcpNetwork, b as RuntimeHttpResponse, O as OutboundPolicy, S as SpawnChild, c as SyncSpawn, d as VolumeStat, e as VolumeStats, f as RuntimePod, g as RuntimePackageInstaller, h as ChildSpawnConfig, i as ChildHandle, j as RuntimeProcess, k as RuntimeSocketPeer, l as RuntimeConnection } from './contracts-C2_dTgk3.cjs';
4
- export { D as DirEntry, m as ROOT_CRED, n as RuntimeProcessManager, o as RuntimeProcessResult, p as Stats, q as VirtualNode, r as VirtualProvider, W as WriteOptions, s as applyChmod, t as createChildProcessModule, u as formatMode, v as makeCred, w as octalMode, x as parseUmask } from './contracts-C2_dTgk3.cjs';
5
- import { M as MemoryVolume, a as MemoryVolumeSnapshotEntry } from './memory-volume-DqEWFo7t.cjs';
1
+ import { S as Shell, a as ShellIO, b as Session, N as Node, c as Command, K as Kernel, E as ExecContext, O as OutputStream, C as Container, B as BinaryBackend, d as createContainer } from './container-BGmhPbSD.cjs';
2
+ export { e as BinaryExecutionRegistry, f as BinaryInfo, g as BinaryRequest, h as BufferSink, i as CallbackSink, j as CommandRegistry, k as ContainerFs, l as ContainerOptions, m as ContextInit, n as Env, o as ExecOptions, p as ExecResult, q as ExecutionDecision, r as ExecutionTier, F as FileData, s as FileInput, t as FileOutput, G as GroupEntry, H as HttpResponse, I as InputStream, J as Job, u as KernelOptions, L as ListeningPort, M as MANIFEST_FORMAT, v as MANIFEST_SCHEMA_VERSION, w as MountEntry, x as NetInterface, y as NetworkOptions, z as NetworkStack, A as NullInput, D as NullOutput, P as PYTHON_VERSION, Q as PasswdEntry, R as Pipe, T as Preparation, U as PreparedBinary, V as Process, W as ProcessKind, X as ProcessOptions, Y as ProcessState, Z as ProcessTable, _ as PythonCapabilities, $ as PythonOptions, a0 as PythonProfile, a1 as PythonRuntimeManifest, a2 as ResolvedExecutable, a3 as RunOptions, a4 as RunResult, a5 as SessionInit, a6 as SessionResult, a7 as SessionRunOptions, a8 as ShellExit, a9 as ShellInit, aa as ShellOptions, ab as SpawnHandle, ac as Stdio, ad as TeeOutput, ae as UserDatabase, af as Variables, ag as WasmCommandArtifact, ah as WasmTranslator, ai as binaryDigest, aj as braceExpand, ak as captureStdio, al as configurePython, am as createContext, an as createTranslationBackend, ao as createWasmCompatibilityBackend, ap as defineCommand, aq as expandWord, ar as expandWords, as as inspectElf, at as installWasmCommands, au as isElfBinary, av as isPythonAvailable, aw as resetPidCounter, ax as shellQuote, ay as validateManifest } from './container-BGmhPbSD.cjs';
3
+ import { V as Vfs, C as Cred, R as RuntimeVolume, a as VirtualTcpNetwork, b as RuntimeHttpResponse, O as OutboundPolicy, S as SpawnChild, c as SyncSpawn, I as IpcTransport, d as VolumeStat, e as VolumeStats, f as RuntimePod, g as RuntimePackageInstaller, h as ChildSpawnConfig, i as ChildHandle, j as RuntimeProcess, k as RuntimeSocketPeer, l as RuntimeConnection } from './contracts-BkWBTH8E.cjs';
4
+ export { D as DirEntry, m as ROOT_CRED, n as RuntimeProcessManager, o as RuntimeProcessResult, p as Stats, q as VirtualNode, r as VirtualProvider, W as WriteOptions, s as applyChmod, t as createChildProcessModule, u as formatMode, v as makeCred, w as octalMode, x as parseUmask } from './contracts-BkWBTH8E.cjs';
5
+ import { M as MemoryVolume, a as MemoryVolumeSnapshotEntry } from './memory-volume-DCm-DiXH.cjs';
6
6
  import EventEmitter from 'events/events.js';
7
7
  import streamModule from 'stream-browserify';
8
8
 
@@ -496,6 +496,7 @@ declare class CommonJsEngine {
496
496
  /** `package.json` per directory; resolution reads them constantly. */
497
497
  private readonly manifests;
498
498
  private evaluationDepth;
499
+ private readonly moduleApi;
499
500
  /**
500
501
  * Is a module body running synchronously right now?
501
502
  *
@@ -610,6 +611,9 @@ declare class VirtualServerResponse extends streamModule.Writable {
610
611
  constructor(request: VirtualIncomingMessage);
611
612
  _write(chunk: any, encoding: BufferEncoding, callback: (error?: Error | null) => void): void;
612
613
  _final(callback: (error?: Error | null) => void): void;
614
+ _destroy(error: Error | null, callback: (error?: Error | null) => void): void;
615
+ private settled;
616
+ private settle;
613
617
  setHeader(name: string, value: string | number | readonly string[]): this;
614
618
  appendHeader(name: string, value: string | readonly string[]): this;
615
619
  getHeader(name: string): string | string[] | undefined;
@@ -619,6 +623,12 @@ declare class VirtualServerResponse extends streamModule.Writable {
619
623
  removeHeader(name: string): void;
620
624
  writeHead(statusCode: number, statusMessage?: string | Record<string, unknown>, headers?: Record<string, unknown>): this;
621
625
  flushHeaders(): void;
626
+ _implicitHeader(): void;
627
+ get _header(): string | null;
628
+ get finished(): boolean;
629
+ chunkedEncoding: boolean;
630
+ useChunkedEncodingByDefault: boolean;
631
+ strictContentLength: boolean;
622
632
  writeContinue(): void;
623
633
  writeProcessing(): void;
624
634
  addTrailers(_headers: Record<string, string>): void;
@@ -760,8 +770,9 @@ interface CoreModulesOptions {
760
770
  cwd?: string;
761
771
  env?: Record<string, string>;
762
772
  argv?: string[];
763
- stdout?: (chunk: string) => void;
764
- stderr?: (chunk: string) => void;
773
+ /** A `Buffer` written to the stream arrives as bytes, a string as a string. */
774
+ stdout?: (chunk: string | Uint8Array) => void;
775
+ stderr?: (chunk: string | Uint8Array) => void;
765
776
  onExit?: (code: number) => void;
766
777
  http?: {
767
778
  router: VirtualHttpRouter;
@@ -793,14 +804,16 @@ interface CoreModulesOptions {
793
804
  tty?: boolean;
794
805
  /** Called when the program turns raw mode on or off. */
795
806
  onRawMode?: (enabled: boolean) => void;
807
+ /** The host's `fork` channels: how a parent opens one and a forked child finds its own. */
808
+ ipc?: IpcTransport;
796
809
  }
797
810
  /** Build the core-module table injected into each isolated JS worker. */
798
811
  declare function createCoreModules(options: CoreModulesOptions): {
799
812
  builtins: Record<string, unknown>;
800
813
  globals: Record<string, unknown>;
801
814
  process: Record<string, any>;
802
- /** Deliver a chunk of input to an interactive `process.stdin`. */
803
- writeStdin(data: string): void;
815
+ /** Deliver a chunk of input to an interactive `process.stdin`; bytes stay bytes. */
816
+ writeStdin(data: string | Uint8Array): void;
804
817
  /** Signal end-of-input to an interactive `process.stdin`. */
805
818
  endStdin(): void;
806
819
  /**
package/dist/index.d.ts CHANGED
@@ -1,8 +1,8 @@
1
- import { S as Shell, a as ShellIO, b as Session, N as Node, c as Command, K as Kernel, E as ExecContext, O as OutputStream, C as Container, B as BinaryBackend, d as createContainer } from './container-CUB12Moo.js';
2
- export { e as BinaryExecutionRegistry, f as BinaryInfo, g as BinaryRequest, h as BufferSink, i as CallbackSink, j as CommandRegistry, k as ContainerFs, l as ContainerOptions, m as ContextInit, n as Env, o as ExecOptions, p as ExecResult, q as ExecutionDecision, r as ExecutionTier, F as FileData, s as FileInput, t as FileOutput, G as GroupEntry, H as HttpResponse, I as InputStream, J as Job, u as KernelOptions, L as ListeningPort, M as MANIFEST_FORMAT, v as MANIFEST_SCHEMA_VERSION, w as MountEntry, x as NetInterface, y as NetworkOptions, z as NetworkStack, A as NullInput, D as NullOutput, P as PYTHON_VERSION, Q as PasswdEntry, R as Pipe, T as Preparation, U as PreparedBinary, V as Process, W as ProcessKind, X as ProcessOptions, Y as ProcessState, Z as ProcessTable, _ as PythonCapabilities, $ as PythonOptions, a0 as PythonProfile, a1 as PythonRuntimeManifest, a2 as ResolvedExecutable, a3 as RunOptions, a4 as RunResult, a5 as SessionInit, a6 as SessionResult, a7 as SessionRunOptions, a8 as ShellExit, a9 as ShellInit, aa as ShellOptions, ab as SpawnHandle, ac as Stdio, ad as TeeOutput, ae as UserDatabase, af as Variables, ag as WasmCommandArtifact, ah as WasmTranslator, ai as binaryDigest, aj as braceExpand, ak as captureStdio, al as configurePython, am as createContext, an as createTranslationBackend, ao as createWasmCompatibilityBackend, ap as defineCommand, aq as expandWord, ar as expandWords, as as inspectElf, at as installWasmCommands, au as isElfBinary, av as isPythonAvailable, aw as resetPidCounter, ax as shellQuote, ay as validateManifest } from './container-CUB12Moo.js';
3
- import { V as Vfs, C as Cred, R as RuntimeVolume, a as VirtualTcpNetwork, b as RuntimeHttpResponse, O as OutboundPolicy, S as SpawnChild, c as SyncSpawn, d as VolumeStat, e as VolumeStats, f as RuntimePod, g as RuntimePackageInstaller, h as ChildSpawnConfig, i as ChildHandle, j as RuntimeProcess, k as RuntimeSocketPeer, l as RuntimeConnection } from './contracts-C2_dTgk3.js';
4
- export { D as DirEntry, m as ROOT_CRED, n as RuntimeProcessManager, o as RuntimeProcessResult, p as Stats, q as VirtualNode, r as VirtualProvider, W as WriteOptions, s as applyChmod, t as createChildProcessModule, u as formatMode, v as makeCred, w as octalMode, x as parseUmask } from './contracts-C2_dTgk3.js';
5
- import { M as MemoryVolume, a as MemoryVolumeSnapshotEntry } from './memory-volume-CG56p660.js';
1
+ import { S as Shell, a as ShellIO, b as Session, N as Node, c as Command, K as Kernel, E as ExecContext, O as OutputStream, C as Container, B as BinaryBackend, d as createContainer } from './container-DCwYX_Cx.js';
2
+ export { e as BinaryExecutionRegistry, f as BinaryInfo, g as BinaryRequest, h as BufferSink, i as CallbackSink, j as CommandRegistry, k as ContainerFs, l as ContainerOptions, m as ContextInit, n as Env, o as ExecOptions, p as ExecResult, q as ExecutionDecision, r as ExecutionTier, F as FileData, s as FileInput, t as FileOutput, G as GroupEntry, H as HttpResponse, I as InputStream, J as Job, u as KernelOptions, L as ListeningPort, M as MANIFEST_FORMAT, v as MANIFEST_SCHEMA_VERSION, w as MountEntry, x as NetInterface, y as NetworkOptions, z as NetworkStack, A as NullInput, D as NullOutput, P as PYTHON_VERSION, Q as PasswdEntry, R as Pipe, T as Preparation, U as PreparedBinary, V as Process, W as ProcessKind, X as ProcessOptions, Y as ProcessState, Z as ProcessTable, _ as PythonCapabilities, $ as PythonOptions, a0 as PythonProfile, a1 as PythonRuntimeManifest, a2 as ResolvedExecutable, a3 as RunOptions, a4 as RunResult, a5 as SessionInit, a6 as SessionResult, a7 as SessionRunOptions, a8 as ShellExit, a9 as ShellInit, aa as ShellOptions, ab as SpawnHandle, ac as Stdio, ad as TeeOutput, ae as UserDatabase, af as Variables, ag as WasmCommandArtifact, ah as WasmTranslator, ai as binaryDigest, aj as braceExpand, ak as captureStdio, al as configurePython, am as createContext, an as createTranslationBackend, ao as createWasmCompatibilityBackend, ap as defineCommand, aq as expandWord, ar as expandWords, as as inspectElf, at as installWasmCommands, au as isElfBinary, av as isPythonAvailable, aw as resetPidCounter, ax as shellQuote, ay as validateManifest } from './container-DCwYX_Cx.js';
3
+ import { V as Vfs, C as Cred, R as RuntimeVolume, a as VirtualTcpNetwork, b as RuntimeHttpResponse, O as OutboundPolicy, S as SpawnChild, c as SyncSpawn, I as IpcTransport, d as VolumeStat, e as VolumeStats, f as RuntimePod, g as RuntimePackageInstaller, h as ChildSpawnConfig, i as ChildHandle, j as RuntimeProcess, k as RuntimeSocketPeer, l as RuntimeConnection } from './contracts-BkWBTH8E.js';
4
+ export { D as DirEntry, m as ROOT_CRED, n as RuntimeProcessManager, o as RuntimeProcessResult, p as Stats, q as VirtualNode, r as VirtualProvider, W as WriteOptions, s as applyChmod, t as createChildProcessModule, u as formatMode, v as makeCred, w as octalMode, x as parseUmask } from './contracts-BkWBTH8E.js';
5
+ import { M as MemoryVolume, a as MemoryVolumeSnapshotEntry } from './memory-volume-DJA-vFYW.js';
6
6
  import EventEmitter from 'events/events.js';
7
7
  import streamModule from 'stream-browserify';
8
8
 
@@ -496,6 +496,7 @@ declare class CommonJsEngine {
496
496
  /** `package.json` per directory; resolution reads them constantly. */
497
497
  private readonly manifests;
498
498
  private evaluationDepth;
499
+ private readonly moduleApi;
499
500
  /**
500
501
  * Is a module body running synchronously right now?
501
502
  *
@@ -610,6 +611,9 @@ declare class VirtualServerResponse extends streamModule.Writable {
610
611
  constructor(request: VirtualIncomingMessage);
611
612
  _write(chunk: any, encoding: BufferEncoding, callback: (error?: Error | null) => void): void;
612
613
  _final(callback: (error?: Error | null) => void): void;
614
+ _destroy(error: Error | null, callback: (error?: Error | null) => void): void;
615
+ private settled;
616
+ private settle;
613
617
  setHeader(name: string, value: string | number | readonly string[]): this;
614
618
  appendHeader(name: string, value: string | readonly string[]): this;
615
619
  getHeader(name: string): string | string[] | undefined;
@@ -619,6 +623,12 @@ declare class VirtualServerResponse extends streamModule.Writable {
619
623
  removeHeader(name: string): void;
620
624
  writeHead(statusCode: number, statusMessage?: string | Record<string, unknown>, headers?: Record<string, unknown>): this;
621
625
  flushHeaders(): void;
626
+ _implicitHeader(): void;
627
+ get _header(): string | null;
628
+ get finished(): boolean;
629
+ chunkedEncoding: boolean;
630
+ useChunkedEncodingByDefault: boolean;
631
+ strictContentLength: boolean;
622
632
  writeContinue(): void;
623
633
  writeProcessing(): void;
624
634
  addTrailers(_headers: Record<string, string>): void;
@@ -760,8 +770,9 @@ interface CoreModulesOptions {
760
770
  cwd?: string;
761
771
  env?: Record<string, string>;
762
772
  argv?: string[];
763
- stdout?: (chunk: string) => void;
764
- stderr?: (chunk: string) => void;
773
+ /** A `Buffer` written to the stream arrives as bytes, a string as a string. */
774
+ stdout?: (chunk: string | Uint8Array) => void;
775
+ stderr?: (chunk: string | Uint8Array) => void;
765
776
  onExit?: (code: number) => void;
766
777
  http?: {
767
778
  router: VirtualHttpRouter;
@@ -793,14 +804,16 @@ interface CoreModulesOptions {
793
804
  tty?: boolean;
794
805
  /** Called when the program turns raw mode on or off. */
795
806
  onRawMode?: (enabled: boolean) => void;
807
+ /** The host's `fork` channels: how a parent opens one and a forked child finds its own. */
808
+ ipc?: IpcTransport;
796
809
  }
797
810
  /** Build the core-module table injected into each isolated JS worker. */
798
811
  declare function createCoreModules(options: CoreModulesOptions): {
799
812
  builtins: Record<string, unknown>;
800
813
  globals: Record<string, unknown>;
801
814
  process: Record<string, any>;
802
- /** Deliver a chunk of input to an interactive `process.stdin`. */
803
- writeStdin(data: string): void;
815
+ /** Deliver a chunk of input to an interactive `process.stdin`; bytes stay bytes. */
816
+ writeStdin(data: string | Uint8Array): void;
804
817
  /** Signal end-of-input to an interactive `process.stdin`. */
805
818
  endStdin(): void;
806
819
  /**