sandboxedjs 0.1.14 → 0.1.16
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 +68 -14
- package/dist/index.cjs +59 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +50 -15
- package/dist/index.d.ts +50 -15
- package/dist/index.js +58 -11
- package/dist/index.js.map +1 -1
- package/dist/integrations/server.cjs +24 -0
- package/dist/integrations/server.cjs.map +1 -0
- package/dist/integrations/server.d.cts +2 -0
- package/dist/integrations/server.d.ts +2 -0
- package/dist/integrations/server.js +3 -0
- package/dist/integrations/server.js.map +1 -0
- package/dist/integrations/vite.cjs +22 -0
- package/dist/integrations/vite.cjs.map +1 -0
- package/dist/integrations/vite.d.cts +1 -0
- package/dist/integrations/vite.d.ts +1 -0
- package/dist/integrations/vite.js +3 -0
- package/dist/integrations/vite.js.map +1 -0
- package/package.json +12 -2
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,19 @@ 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;
|
|
1497
|
+
/**
|
|
1498
|
+
* Forwarded to Nodepod when this package boots it in a browser. `swUrl`
|
|
1499
|
+
* points at the service worker if you serve it somewhere other than
|
|
1500
|
+
* `/__sw__.js`; `serviceWorker: false` skips registration entirely, which
|
|
1501
|
+
* also disables preview iframes.
|
|
1502
|
+
*/
|
|
1503
|
+
browser?: {
|
|
1504
|
+
swUrl?: string;
|
|
1505
|
+
serviceWorker?: boolean;
|
|
1506
|
+
watermark?: boolean;
|
|
1507
|
+
};
|
|
1460
1508
|
}
|
|
1461
1509
|
interface ExecOptions {
|
|
1462
1510
|
cwd?: string;
|
|
@@ -1956,19 +2004,6 @@ declare function buildRootfs(vfs: Vfs, opts?: RootfsOptions): void;
|
|
|
1956
2004
|
|
|
1957
2005
|
declare const NODE_VERSION = "v22.12.0";
|
|
1958
2006
|
|
|
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
2007
|
/**
|
|
1973
2008
|
* Package managers: `npm`/`npx`/`yarn`/`pnpm` on top of Nodepod's installer,
|
|
1974
2009
|
* and an `apt`-shaped front end for the things a container image would ship.
|
|
@@ -1994,4 +2029,4 @@ declare const NPM_VERSION = "10.9.0";
|
|
|
1994
2029
|
* ```
|
|
1995
2030
|
*/
|
|
1996
2031
|
|
|
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 };
|
|
2032
|
+
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,19 @@ 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;
|
|
1497
|
+
/**
|
|
1498
|
+
* Forwarded to Nodepod when this package boots it in a browser. `swUrl`
|
|
1499
|
+
* points at the service worker if you serve it somewhere other than
|
|
1500
|
+
* `/__sw__.js`; `serviceWorker: false` skips registration entirely, which
|
|
1501
|
+
* also disables preview iframes.
|
|
1502
|
+
*/
|
|
1503
|
+
browser?: {
|
|
1504
|
+
swUrl?: string;
|
|
1505
|
+
serviceWorker?: boolean;
|
|
1506
|
+
watermark?: boolean;
|
|
1507
|
+
};
|
|
1460
1508
|
}
|
|
1461
1509
|
interface ExecOptions {
|
|
1462
1510
|
cwd?: string;
|
|
@@ -1956,19 +2004,6 @@ declare function buildRootfs(vfs: Vfs, opts?: RootfsOptions): void;
|
|
|
1956
2004
|
|
|
1957
2005
|
declare const NODE_VERSION = "v22.12.0";
|
|
1958
2006
|
|
|
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
2007
|
/**
|
|
1973
2008
|
* Package managers: `npm`/`npx`/`yarn`/`pnpm` on top of Nodepod's installer,
|
|
1974
2009
|
* and an `apt`-shaped front end for the things a container image would ship.
|
|
@@ -1994,4 +2029,4 @@ declare const NPM_VERSION = "10.9.0";
|
|
|
1994
2029
|
* ```
|
|
1995
2030
|
*/
|
|
1996
2031
|
|
|
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 };
|
|
2032
|
+
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
|
});
|
|
@@ -23177,6 +23191,12 @@ function packageBinaries(ctx, root, packageName) {
|
|
|
23177
23191
|
}
|
|
23178
23192
|
return [];
|
|
23179
23193
|
}
|
|
23194
|
+
var CLI_MOVED_TO = {
|
|
23195
|
+
tailwindcss: "@tailwindcss/cli",
|
|
23196
|
+
postcss: "postcss-cli",
|
|
23197
|
+
autoprefixer: "postcss-cli",
|
|
23198
|
+
sass: "sass-embedded"
|
|
23199
|
+
};
|
|
23180
23200
|
function findLocalBin(ctx, name) {
|
|
23181
23201
|
let dir3 = ctx.cwd;
|
|
23182
23202
|
for (let i = 0; i < 64; i++) {
|
|
@@ -23283,6 +23303,14 @@ unless the container was created with network: { allowOutbound: true }.`,
|
|
|
23283
23303
|
const chosen = binaries.includes(command) ? command : binaries[0];
|
|
23284
23304
|
if (chosen === void 0) {
|
|
23285
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
|
+
}
|
|
23286
23314
|
return 127;
|
|
23287
23315
|
}
|
|
23288
23316
|
command = chosen;
|
|
@@ -23859,14 +23887,9 @@ var Container = class _Container {
|
|
|
23859
23887
|
}
|
|
23860
23888
|
// ── boot ──────────────────────────────────────────────────────────────────
|
|
23861
23889
|
static async create(opts = {}) {
|
|
23862
|
-
if (
|
|
23863
|
-
|
|
23864
|
-
|
|
23865
|
-
serviceWorker: false,
|
|
23866
|
-
env: opts.env ?? {},
|
|
23867
|
-
workdir: opts.cwd ?? "/",
|
|
23868
|
-
...opts.onServerReady ? { onServerReady: opts.onServerReady } : {}
|
|
23869
|
-
});
|
|
23890
|
+
if (opts.python) configurePython(opts.python);
|
|
23891
|
+
if (!opts.pod && isNodeRuntime()) await installEsbuildRuntime();
|
|
23892
|
+
const pod = opts.pod ?? (isNodeRuntime() ? await bootHeadlessPod(opts) : await bootBrowserPod(opts));
|
|
23870
23893
|
const kernel = new Kernel({
|
|
23871
23894
|
pod,
|
|
23872
23895
|
hostname: opts.hostname ?? "sandbox",
|
|
@@ -24288,6 +24311,30 @@ function normalizeHeaders(headers) {
|
|
|
24288
24311
|
async function createContainer(opts = {}) {
|
|
24289
24312
|
return Container.create(opts);
|
|
24290
24313
|
}
|
|
24314
|
+
function isNodeRuntime() {
|
|
24315
|
+
return typeof process !== "undefined" && process.versions != null && process.versions.node != null;
|
|
24316
|
+
}
|
|
24317
|
+
async function bootBrowserPod(opts) {
|
|
24318
|
+
const { Nodepod } = await import('@scelar/nodepod');
|
|
24319
|
+
return Nodepod.boot({
|
|
24320
|
+
env: opts.env ?? {},
|
|
24321
|
+
workdir: opts.cwd ?? "/",
|
|
24322
|
+
...opts.browser ?? {},
|
|
24323
|
+
...opts.onServerReady ? { onServerReady: opts.onServerReady } : {}
|
|
24324
|
+
});
|
|
24325
|
+
}
|
|
24326
|
+
async function bootHeadlessPod(opts) {
|
|
24327
|
+
const { Nodepod } = await nodeOnlyModule(
|
|
24328
|
+
"@scelar/nodepod/headless"
|
|
24329
|
+
);
|
|
24330
|
+
return Nodepod.boot({
|
|
24331
|
+
headless: true,
|
|
24332
|
+
serviceWorker: false,
|
|
24333
|
+
env: opts.env ?? {},
|
|
24334
|
+
workdir: opts.cwd ?? "/",
|
|
24335
|
+
...opts.onServerReady ? { onServerReady: opts.onServerReady } : {}
|
|
24336
|
+
});
|
|
24337
|
+
}
|
|
24291
24338
|
|
|
24292
24339
|
// src/container/terminal.ts
|
|
24293
24340
|
init_path();
|
|
@@ -24728,6 +24775,6 @@ init_expand();
|
|
|
24728
24775
|
init_builtins();
|
|
24729
24776
|
var src_default = createContainer;
|
|
24730
24777
|
|
|
24731
|
-
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 };
|
|
24778
|
+
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 };
|
|
24732
24779
|
//# sourceMappingURL=index.js.map
|
|
24733
24780
|
//# sourceMappingURL=index.js.map
|