sandboxedjs 0.1.13 → 0.1.15
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/README.md +49 -7
- package/dist/index.cjs +53 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +39 -15
- package/dist/index.d.ts +39 -15
- package/dist/index.js +52 -11
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MemoryVolume, Nodepod } from '@scelar/nodepod
|
|
1
|
+
import { MemoryVolume, Nodepod } from '@scelar/nodepod';
|
|
2
2
|
|
|
3
3
|
type FileKind = "file" | "directory" | "symlink" | "chardev" | "blockdev" | "fifo" | "socket";
|
|
4
4
|
/** Render as `drwxr-xr-x`, honouring setuid/setgid/sticky. */
|
|
@@ -1288,6 +1288,41 @@ declare class Shell {
|
|
|
1288
1288
|
reapJobs(): Job[];
|
|
1289
1289
|
}
|
|
1290
1290
|
|
|
1291
|
+
/**
|
|
1292
|
+
* The Python runtime: MicroPython compiled to WebAssembly, wired to the
|
|
1293
|
+
* container's filesystem, argv, environment and standard streams.
|
|
1294
|
+
*
|
|
1295
|
+
* A fresh interpreter is created per process, which is both correct (no state
|
|
1296
|
+
* leaks between runs) and cheap — the WASM module is compiled once and reused,
|
|
1297
|
+
* so subsequent instantiations take single-digit milliseconds.
|
|
1298
|
+
*/
|
|
1299
|
+
|
|
1300
|
+
declare const PYTHON_VERSION = "3.4.0";
|
|
1301
|
+
interface PythonOptions {
|
|
1302
|
+
/**
|
|
1303
|
+
* Absolute URL of `micropython.wasm`.
|
|
1304
|
+
*
|
|
1305
|
+
* Emscripten resolves the binary against the script's own directory, which
|
|
1306
|
+
* is right in Node and wrong in a browser: a bundler rewrites the loader to
|
|
1307
|
+
* a hashed chunk, the guess lands on a path the dev server answers with
|
|
1308
|
+
* `index.html`, and instantiation dies on `expected magic word 00 61 73 6d,
|
|
1309
|
+
* found 3c 21 64 6f` — the first four bytes of `<!doctype`.
|
|
1310
|
+
*
|
|
1311
|
+
* Every bundler spells "give me the URL of this asset" differently, so the
|
|
1312
|
+
* host supplies it rather than this module trying to detect one:
|
|
1313
|
+
*
|
|
1314
|
+
* ```ts
|
|
1315
|
+
* import wasm from "@micropython/micropython-webassembly-pyscript/micropython.wasm?url";
|
|
1316
|
+
* await createContainer({ pod, python: { wasmUrl: wasm } });
|
|
1317
|
+
* ```
|
|
1318
|
+
*/
|
|
1319
|
+
wasmUrl?: string;
|
|
1320
|
+
}
|
|
1321
|
+
/** Point the Python runtime at its WebAssembly binary. */
|
|
1322
|
+
declare function configurePython(options?: PythonOptions): void;
|
|
1323
|
+
/** True when a Python interpreter can be started in this process. */
|
|
1324
|
+
declare function isPythonAvailable(): Promise<boolean>;
|
|
1325
|
+
|
|
1291
1326
|
/**
|
|
1292
1327
|
* A promise-based filesystem façade for host code, shaped like `fs/promises`
|
|
1293
1328
|
* so it reads naturally from the outside.
|
|
@@ -1457,6 +1492,8 @@ interface ContainerOptions {
|
|
|
1457
1492
|
* ```
|
|
1458
1493
|
*/
|
|
1459
1494
|
pod?: Nodepod;
|
|
1495
|
+
/** Python runtime settings; a browser host uses this to locate the wasm. */
|
|
1496
|
+
python?: PythonOptions;
|
|
1460
1497
|
}
|
|
1461
1498
|
interface ExecOptions {
|
|
1462
1499
|
cwd?: string;
|
|
@@ -1956,19 +1993,6 @@ declare function buildRootfs(vfs: Vfs, opts?: RootfsOptions): void;
|
|
|
1956
1993
|
|
|
1957
1994
|
declare const NODE_VERSION = "v22.12.0";
|
|
1958
1995
|
|
|
1959
|
-
/**
|
|
1960
|
-
* The Python runtime: MicroPython compiled to WebAssembly, wired to the
|
|
1961
|
-
* container's filesystem, argv, environment and standard streams.
|
|
1962
|
-
*
|
|
1963
|
-
* A fresh interpreter is created per process, which is both correct (no state
|
|
1964
|
-
* leaks between runs) and cheap — the WASM module is compiled once and reused,
|
|
1965
|
-
* so subsequent instantiations take single-digit milliseconds.
|
|
1966
|
-
*/
|
|
1967
|
-
|
|
1968
|
-
declare const PYTHON_VERSION = "3.4.0";
|
|
1969
|
-
/** True when a Python interpreter can be started in this process. */
|
|
1970
|
-
declare function isPythonAvailable(): Promise<boolean>;
|
|
1971
|
-
|
|
1972
1996
|
/**
|
|
1973
1997
|
* Package managers: `npm`/`npx`/`yarn`/`pnpm` on top of Nodepod's installer,
|
|
1974
1998
|
* and an `apt`-shaped front end for the things a container image would ship.
|
|
@@ -1994,4 +2018,4 @@ declare const NPM_VERSION = "10.9.0";
|
|
|
1994
2018
|
* ```
|
|
1995
2019
|
*/
|
|
1996
2020
|
|
|
1997
|
-
export { ArithError, BufferSink, CallbackSink, type Command, CommandRegistry, Container, ContainerFs, type ContainerOptions, type ContextInit, type Cred, type DirEntry, ERRNO, type Env, type ErrnoCode, type ExecContext, type ExecOptions, type ExecResult, type FileData, FileInput, FileOutput, type GroupEntry, type HttpResponse, IncompleteInputError, type InputStream, type Job, KERNEL_NAME, KERNEL_RELEASE, Kernel, type KernelOptions, type ListeningPort, 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, ROOT_CRED, type ResolvedExecutable, type RootfsOptions, type RunOptions, type RunResult, SIGNALS, SIGNAL_NAMES, Session, type SessionInit, type SessionResult, type SessionRunOptions, Shell, ShellExit, type ShellIO, type ShellInit, Lexer as ShellLexer, type ShellOptions, ShellSyntaxError, type SpawnHandle, Stats, type Stdio, SysError, TeeOutput, Terminal, type TerminalOptions, UserDatabase, Variables, Vfs, type VirtualNode, type VirtualProvider, type WriteOptions, allCommands, applyChmod, braceExpand, buildRootfs, builtinNames, captureStdio, createContainer, createContext, createContainer as default, defineCommand, evalArith, exitCodeForSignal, expandPrompt, expandWord, expandWords, fnmatch, formatMode, getBuiltin, glob, globToRegex, hasMagic, installUserland, isBuiltinName, isPythonAvailable, isSysError, makeCred, normalizeSignal, octalMode, parse as parseShell, parseUmask, path as posixPath, resetPidCounter, shellQuote, strerror, unameInfo };
|
|
2021
|
+
export { ArithError, BufferSink, CallbackSink, type Command, CommandRegistry, Container, ContainerFs, type ContainerOptions, type ContextInit, type Cred, type DirEntry, ERRNO, type Env, type ErrnoCode, type ExecContext, type ExecOptions, type ExecResult, type FileData, FileInput, FileOutput, type GroupEntry, type HttpResponse, IncompleteInputError, type InputStream, type Job, KERNEL_NAME, KERNEL_RELEASE, Kernel, type KernelOptions, type ListeningPort, 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, SIGNALS, SIGNAL_NAMES, Session, type SessionInit, type SessionResult, type SessionRunOptions, Shell, ShellExit, type ShellIO, type ShellInit, Lexer as ShellLexer, type ShellOptions, ShellSyntaxError, type SpawnHandle, Stats, type Stdio, SysError, TeeOutput, Terminal, type TerminalOptions, UserDatabase, Variables, Vfs, type VirtualNode, type VirtualProvider, type WriteOptions, allCommands, applyChmod, braceExpand, buildRootfs, builtinNames, captureStdio, configurePython, createContainer, createContext, createContainer as default, defineCommand, evalArith, exitCodeForSignal, expandPrompt, expandWord, expandWords, fnmatch, formatMode, getBuiltin, glob, globToRegex, hasMagic, installUserland, isBuiltinName, isPythonAvailable, isSysError, makeCred, normalizeSignal, octalMode, parse as parseShell, parseUmask, path as posixPath, resetPidCounter, shellQuote, strerror, unameInfo };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MemoryVolume, Nodepod } from '@scelar/nodepod
|
|
1
|
+
import { MemoryVolume, Nodepod } from '@scelar/nodepod';
|
|
2
2
|
|
|
3
3
|
type FileKind = "file" | "directory" | "symlink" | "chardev" | "blockdev" | "fifo" | "socket";
|
|
4
4
|
/** Render as `drwxr-xr-x`, honouring setuid/setgid/sticky. */
|
|
@@ -1288,6 +1288,41 @@ declare class Shell {
|
|
|
1288
1288
|
reapJobs(): Job[];
|
|
1289
1289
|
}
|
|
1290
1290
|
|
|
1291
|
+
/**
|
|
1292
|
+
* The Python runtime: MicroPython compiled to WebAssembly, wired to the
|
|
1293
|
+
* container's filesystem, argv, environment and standard streams.
|
|
1294
|
+
*
|
|
1295
|
+
* A fresh interpreter is created per process, which is both correct (no state
|
|
1296
|
+
* leaks between runs) and cheap — the WASM module is compiled once and reused,
|
|
1297
|
+
* so subsequent instantiations take single-digit milliseconds.
|
|
1298
|
+
*/
|
|
1299
|
+
|
|
1300
|
+
declare const PYTHON_VERSION = "3.4.0";
|
|
1301
|
+
interface PythonOptions {
|
|
1302
|
+
/**
|
|
1303
|
+
* Absolute URL of `micropython.wasm`.
|
|
1304
|
+
*
|
|
1305
|
+
* Emscripten resolves the binary against the script's own directory, which
|
|
1306
|
+
* is right in Node and wrong in a browser: a bundler rewrites the loader to
|
|
1307
|
+
* a hashed chunk, the guess lands on a path the dev server answers with
|
|
1308
|
+
* `index.html`, and instantiation dies on `expected magic word 00 61 73 6d,
|
|
1309
|
+
* found 3c 21 64 6f` — the first four bytes of `<!doctype`.
|
|
1310
|
+
*
|
|
1311
|
+
* Every bundler spells "give me the URL of this asset" differently, so the
|
|
1312
|
+
* host supplies it rather than this module trying to detect one:
|
|
1313
|
+
*
|
|
1314
|
+
* ```ts
|
|
1315
|
+
* import wasm from "@micropython/micropython-webassembly-pyscript/micropython.wasm?url";
|
|
1316
|
+
* await createContainer({ pod, python: { wasmUrl: wasm } });
|
|
1317
|
+
* ```
|
|
1318
|
+
*/
|
|
1319
|
+
wasmUrl?: string;
|
|
1320
|
+
}
|
|
1321
|
+
/** Point the Python runtime at its WebAssembly binary. */
|
|
1322
|
+
declare function configurePython(options?: PythonOptions): void;
|
|
1323
|
+
/** True when a Python interpreter can be started in this process. */
|
|
1324
|
+
declare function isPythonAvailable(): Promise<boolean>;
|
|
1325
|
+
|
|
1291
1326
|
/**
|
|
1292
1327
|
* A promise-based filesystem façade for host code, shaped like `fs/promises`
|
|
1293
1328
|
* so it reads naturally from the outside.
|
|
@@ -1457,6 +1492,8 @@ interface ContainerOptions {
|
|
|
1457
1492
|
* ```
|
|
1458
1493
|
*/
|
|
1459
1494
|
pod?: Nodepod;
|
|
1495
|
+
/** Python runtime settings; a browser host uses this to locate the wasm. */
|
|
1496
|
+
python?: PythonOptions;
|
|
1460
1497
|
}
|
|
1461
1498
|
interface ExecOptions {
|
|
1462
1499
|
cwd?: string;
|
|
@@ -1956,19 +1993,6 @@ declare function buildRootfs(vfs: Vfs, opts?: RootfsOptions): void;
|
|
|
1956
1993
|
|
|
1957
1994
|
declare const NODE_VERSION = "v22.12.0";
|
|
1958
1995
|
|
|
1959
|
-
/**
|
|
1960
|
-
* The Python runtime: MicroPython compiled to WebAssembly, wired to the
|
|
1961
|
-
* container's filesystem, argv, environment and standard streams.
|
|
1962
|
-
*
|
|
1963
|
-
* A fresh interpreter is created per process, which is both correct (no state
|
|
1964
|
-
* leaks between runs) and cheap — the WASM module is compiled once and reused,
|
|
1965
|
-
* so subsequent instantiations take single-digit milliseconds.
|
|
1966
|
-
*/
|
|
1967
|
-
|
|
1968
|
-
declare const PYTHON_VERSION = "3.4.0";
|
|
1969
|
-
/** True when a Python interpreter can be started in this process. */
|
|
1970
|
-
declare function isPythonAvailable(): Promise<boolean>;
|
|
1971
|
-
|
|
1972
1996
|
/**
|
|
1973
1997
|
* Package managers: `npm`/`npx`/`yarn`/`pnpm` on top of Nodepod's installer,
|
|
1974
1998
|
* and an `apt`-shaped front end for the things a container image would ship.
|
|
@@ -1994,4 +2018,4 @@ declare const NPM_VERSION = "10.9.0";
|
|
|
1994
2018
|
* ```
|
|
1995
2019
|
*/
|
|
1996
2020
|
|
|
1997
|
-
export { ArithError, BufferSink, CallbackSink, type Command, CommandRegistry, Container, ContainerFs, type ContainerOptions, type ContextInit, type Cred, type DirEntry, ERRNO, type Env, type ErrnoCode, type ExecContext, type ExecOptions, type ExecResult, type FileData, FileInput, FileOutput, type GroupEntry, type HttpResponse, IncompleteInputError, type InputStream, type Job, KERNEL_NAME, KERNEL_RELEASE, Kernel, type KernelOptions, type ListeningPort, 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, ROOT_CRED, type ResolvedExecutable, type RootfsOptions, type RunOptions, type RunResult, SIGNALS, SIGNAL_NAMES, Session, type SessionInit, type SessionResult, type SessionRunOptions, Shell, ShellExit, type ShellIO, type ShellInit, Lexer as ShellLexer, type ShellOptions, ShellSyntaxError, type SpawnHandle, Stats, type Stdio, SysError, TeeOutput, Terminal, type TerminalOptions, UserDatabase, Variables, Vfs, type VirtualNode, type VirtualProvider, type WriteOptions, allCommands, applyChmod, braceExpand, buildRootfs, builtinNames, captureStdio, createContainer, createContext, createContainer as default, defineCommand, evalArith, exitCodeForSignal, expandPrompt, expandWord, expandWords, fnmatch, formatMode, getBuiltin, glob, globToRegex, hasMagic, installUserland, isBuiltinName, isPythonAvailable, isSysError, makeCred, normalizeSignal, octalMode, parse as parseShell, parseUmask, path as posixPath, resetPidCounter, shellQuote, strerror, unameInfo };
|
|
2021
|
+
export { ArithError, BufferSink, CallbackSink, type Command, CommandRegistry, Container, ContainerFs, type ContainerOptions, type ContextInit, type Cred, type DirEntry, ERRNO, type Env, type ErrnoCode, type ExecContext, type ExecOptions, type ExecResult, type FileData, FileInput, FileOutput, type GroupEntry, type HttpResponse, IncompleteInputError, type InputStream, type Job, KERNEL_NAME, KERNEL_RELEASE, Kernel, type KernelOptions, type ListeningPort, 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, SIGNALS, SIGNAL_NAMES, Session, type SessionInit, type SessionResult, type SessionRunOptions, Shell, ShellExit, type ShellIO, type ShellInit, Lexer as ShellLexer, type ShellOptions, ShellSyntaxError, type SpawnHandle, Stats, type Stdio, SysError, TeeOutput, Terminal, type TerminalOptions, UserDatabase, Variables, Vfs, type VirtualNode, type VirtualProvider, type WriteOptions, allCommands, applyChmod, braceExpand, buildRootfs, builtinNames, captureStdio, configurePython, createContainer, createContext, createContainer as default, defineCommand, evalArith, exitCodeForSignal, expandPrompt, expandWord, expandWords, fnmatch, formatMode, getBuiltin, glob, globToRegex, hasMagic, installUserland, isBuiltinName, isPythonAvailable, isSysError, makeCred, normalizeSignal, octalMode, parse as parseShell, parseUmask, path as posixPath, resetPidCounter, shellQuote, strerror, unameInfo };
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DependencyInstaller } from '@scelar/nodepod';
|
|
2
2
|
import { parse as parse$1 } from 'acorn';
|
|
3
3
|
|
|
4
4
|
var __defProp = Object.defineProperty;
|
|
@@ -8548,6 +8548,15 @@ async function nodeBuiltin(name) {
|
|
|
8548
8548
|
specifier
|
|
8549
8549
|
);
|
|
8550
8550
|
}
|
|
8551
|
+
async function nodeOnlyModule(specifier) {
|
|
8552
|
+
const parts = specifier.split("/");
|
|
8553
|
+
const runtimeSpecifier = parts.join("/");
|
|
8554
|
+
return await import(
|
|
8555
|
+
/* @vite-ignore */
|
|
8556
|
+
/* webpackIgnore: true */
|
|
8557
|
+
runtimeSpecifier
|
|
8558
|
+
);
|
|
8559
|
+
}
|
|
8551
8560
|
var zlibPromise = null;
|
|
8552
8561
|
function nodeZlib() {
|
|
8553
8562
|
zlibPromise ??= nodeBuiltin("zlib");
|
|
@@ -8750,7 +8759,7 @@ function installEsbuildRuntime() {
|
|
|
8750
8759
|
async function install() {
|
|
8751
8760
|
const workerPath = await buildPatchedWorker();
|
|
8752
8761
|
if (!workerPath) return;
|
|
8753
|
-
const { createNodeHost, setRuntimeHost } = await
|
|
8762
|
+
const { createNodeHost, setRuntimeHost } = await nodeOnlyModule("@scelar/nodepod/headless");
|
|
8754
8763
|
setRuntimeHost(createNodeHost({ workerPath }));
|
|
8755
8764
|
}
|
|
8756
8765
|
async function buildPatchedWorker() {
|
|
@@ -22139,6 +22148,10 @@ init_path();
|
|
|
22139
22148
|
var PYTHON_VERSION = "3.4.0";
|
|
22140
22149
|
var MICROPYTHON_BANNER = "MicroPython v1.28.0 on 2026-04-06; SandboxedJS with Emscripten";
|
|
22141
22150
|
var loaderPromise = null;
|
|
22151
|
+
var wasmUrl;
|
|
22152
|
+
function configurePython(options = {}) {
|
|
22153
|
+
if (options.wasmUrl !== void 0) wasmUrl = options.wasmUrl;
|
|
22154
|
+
}
|
|
22142
22155
|
async function getLoader() {
|
|
22143
22156
|
if (!loaderPromise) {
|
|
22144
22157
|
loaderPromise = import('@micropython/micropython-webassembly-pyscript/micropython.mjs').then(
|
|
@@ -22161,6 +22174,7 @@ async function createInterpreter(ctx, opts) {
|
|
|
22161
22174
|
stdout: opts.stdout,
|
|
22162
22175
|
stderr: opts.stderr,
|
|
22163
22176
|
...opts.stdin ? { stdin: opts.stdin } : {},
|
|
22177
|
+
...wasmUrl ? { url: wasmUrl } : {},
|
|
22164
22178
|
linebuffer: false,
|
|
22165
22179
|
heapsize: opts.heapsize ?? 64 * 1024 * 1024
|
|
22166
22180
|
});
|
|
@@ -22542,7 +22556,13 @@ async function loadFactory() {
|
|
|
22542
22556
|
const { createRequire } = await nodeBuiltin("module");
|
|
22543
22557
|
const fs = await nodeBuiltin("fs/promises");
|
|
22544
22558
|
const path = await nodeBuiltin("path");
|
|
22545
|
-
const
|
|
22559
|
+
const packageRequire = createRequire(import.meta.url);
|
|
22560
|
+
let require2 = packageRequire;
|
|
22561
|
+
try {
|
|
22562
|
+
require2.resolve("@ffmpeg/core/wasm");
|
|
22563
|
+
} catch {
|
|
22564
|
+
require2 = createRequire(path.join(process.cwd(), "index.js"));
|
|
22565
|
+
}
|
|
22546
22566
|
const wasmPath = require2.resolve("@ffmpeg/core/wasm");
|
|
22547
22567
|
const wasm = await fs.readFile(wasmPath);
|
|
22548
22568
|
const module = await Promise.resolve().then(() => (init_ffmpeg_core(), ffmpeg_core_exports));
|
|
@@ -23171,6 +23191,12 @@ function packageBinaries(ctx, root, packageName) {
|
|
|
23171
23191
|
}
|
|
23172
23192
|
return [];
|
|
23173
23193
|
}
|
|
23194
|
+
var CLI_MOVED_TO = {
|
|
23195
|
+
tailwindcss: "@tailwindcss/cli",
|
|
23196
|
+
postcss: "postcss-cli",
|
|
23197
|
+
autoprefixer: "postcss-cli",
|
|
23198
|
+
sass: "sass-embedded"
|
|
23199
|
+
};
|
|
23174
23200
|
function findLocalBin(ctx, name) {
|
|
23175
23201
|
let dir3 = ctx.cwd;
|
|
23176
23202
|
for (let i = 0; i < 64; i++) {
|
|
@@ -23277,6 +23303,14 @@ unless the container was created with network: { allowOutbound: true }.`,
|
|
|
23277
23303
|
const chosen = binaries.includes(command) ? command : binaries[0];
|
|
23278
23304
|
if (chosen === void 0) {
|
|
23279
23305
|
ctx.warn(`could not determine executable to run: ${packageName} provides no binary`);
|
|
23306
|
+
const replacement = CLI_MOVED_TO[packageName];
|
|
23307
|
+
if (replacement !== void 0) {
|
|
23308
|
+
ctx.warn(`'${packageName}' ships no CLI; its command lives in '${replacement}'.`);
|
|
23309
|
+
ctx.warn(`Try: npx ${replacement} ${rest.join(" ")}`.trimEnd());
|
|
23310
|
+
} else {
|
|
23311
|
+
ctx.warn(`'${packageName}' is installed but declares no "bin" entry.`);
|
|
23312
|
+
ctx.warn("Check which package provides the command, or use `npx -p <pkg> <command>`.");
|
|
23313
|
+
}
|
|
23280
23314
|
return 127;
|
|
23281
23315
|
}
|
|
23282
23316
|
command = chosen;
|
|
@@ -23853,14 +23887,9 @@ var Container = class _Container {
|
|
|
23853
23887
|
}
|
|
23854
23888
|
// ── boot ──────────────────────────────────────────────────────────────────
|
|
23855
23889
|
static async create(opts = {}) {
|
|
23890
|
+
if (opts.python) configurePython(opts.python);
|
|
23856
23891
|
if (!opts.pod) await installEsbuildRuntime();
|
|
23857
|
-
const pod = opts.pod ?? await
|
|
23858
|
-
headless: true,
|
|
23859
|
-
serviceWorker: false,
|
|
23860
|
-
env: opts.env ?? {},
|
|
23861
|
-
workdir: opts.cwd ?? "/",
|
|
23862
|
-
...opts.onServerReady ? { onServerReady: opts.onServerReady } : {}
|
|
23863
|
-
});
|
|
23892
|
+
const pod = opts.pod ?? await bootHeadlessPod(opts);
|
|
23864
23893
|
const kernel = new Kernel({
|
|
23865
23894
|
pod,
|
|
23866
23895
|
hostname: opts.hostname ?? "sandbox",
|
|
@@ -24282,6 +24311,18 @@ function normalizeHeaders(headers) {
|
|
|
24282
24311
|
async function createContainer(opts = {}) {
|
|
24283
24312
|
return Container.create(opts);
|
|
24284
24313
|
}
|
|
24314
|
+
async function bootHeadlessPod(opts) {
|
|
24315
|
+
const { Nodepod } = await nodeOnlyModule(
|
|
24316
|
+
"@scelar/nodepod/headless"
|
|
24317
|
+
);
|
|
24318
|
+
return Nodepod.boot({
|
|
24319
|
+
headless: true,
|
|
24320
|
+
serviceWorker: false,
|
|
24321
|
+
env: opts.env ?? {},
|
|
24322
|
+
workdir: opts.cwd ?? "/",
|
|
24323
|
+
...opts.onServerReady ? { onServerReady: opts.onServerReady } : {}
|
|
24324
|
+
});
|
|
24325
|
+
}
|
|
24285
24326
|
|
|
24286
24327
|
// src/container/terminal.ts
|
|
24287
24328
|
init_path();
|
|
@@ -24722,6 +24763,6 @@ init_expand();
|
|
|
24722
24763
|
init_builtins();
|
|
24723
24764
|
var src_default = createContainer;
|
|
24724
24765
|
|
|
24725
|
-
export { ArithError, BufferSink, CallbackSink, CommandRegistry, Container, ContainerFs, ERRNO, FileInput, FileOutput, IncompleteInputError, KERNEL_NAME, KERNEL_RELEASE, Kernel, NODE_VERSION, NPM_VERSION, NetworkStack, NullInput, NullOutput, OS_RELEASE, PYTHON_VERSION, Pipe, Process, ProcessTable, ROOT_CRED, SIGNALS, SIGNAL_NAMES, Session, Shell, ShellExit, Lexer as ShellLexer, ShellSyntaxError, Stats, SysError, TeeOutput, Terminal, UserDatabase, Variables, Vfs, allCommands, applyChmod, braceExpand, buildRootfs, builtinNames, captureStdio, createContainer, createContext, src_default as default, defineCommand, evalArith, exitCodeForSignal, expandPrompt, expandWord, expandWords, fnmatch, formatMode, getBuiltin, glob, globToRegex, hasMagic, installUserland, isBuiltinName, isPythonAvailable, isSysError, makeCred, normalizeSignal, octalMode, parse as parseShell, parseUmask, path_exports as posixPath, resetPidCounter, shellQuote, strerror, unameInfo };
|
|
24766
|
+
export { ArithError, BufferSink, CallbackSink, CommandRegistry, Container, ContainerFs, ERRNO, FileInput, FileOutput, IncompleteInputError, KERNEL_NAME, KERNEL_RELEASE, Kernel, NODE_VERSION, NPM_VERSION, NetworkStack, NullInput, NullOutput, OS_RELEASE, PYTHON_VERSION, Pipe, Process, ProcessTable, ROOT_CRED, SIGNALS, SIGNAL_NAMES, Session, Shell, ShellExit, Lexer as ShellLexer, ShellSyntaxError, Stats, SysError, TeeOutput, Terminal, UserDatabase, Variables, Vfs, allCommands, applyChmod, braceExpand, buildRootfs, builtinNames, captureStdio, configurePython, createContainer, createContext, src_default as default, defineCommand, evalArith, exitCodeForSignal, expandPrompt, expandWord, expandWords, fnmatch, formatMode, getBuiltin, glob, globToRegex, hasMagic, installUserland, isBuiltinName, isPythonAvailable, isSysError, makeCred, normalizeSignal, octalMode, parse as parseShell, parseUmask, path_exports as posixPath, resetPidCounter, shellQuote, strerror, unameInfo };
|
|
24726
24767
|
//# sourceMappingURL=index.js.map
|
|
24727
24768
|
//# sourceMappingURL=index.js.map
|