feat(smartdeno): Run small scripts in-memory via stdin, fall back to temp files for large scripts; remove internal HTTP script server and simplify plugin dependencies; update API and docs.

This commit is contained in:
2025-12-02 11:39:46 +00:00
parent 51b0af3d2e
commit d4a100ff32
10 changed files with 121 additions and 247 deletions

View File

@@ -43,9 +43,6 @@ await smartDeno.stop();
await smartDeno.start({
// Force download a local copy of Deno even if it's in PATH
forceLocalDeno: true,
// Custom port for the internal script server (default: 3210)
port: 4000,
});
```
@@ -153,7 +150,7 @@ const smartDeno = new SmartDeno();
app.use(express.json());
// Initialize on startup
await smartDeno.start({ port: 3211 });
await smartDeno.start();
app.post('/execute', async (req, res) => {
const { script, permissions } = req.body;
@@ -180,8 +177,8 @@ app.listen(3000);
SmartDeno works by:
1. **🦕 Deno Management** — Automatically downloads the latest Deno binary for your platform if not available or if `forceLocalDeno` is set
2. **🖥️ Script Server** — Runs an internal HTTP server that serves scripts to Deno
3. **⚡ Ephemeral Execution** — Each script execution is isolated and cleaned up after completion
2. **💾 In-Memory Execution** — Scripts < 2MB are executed via stdin (`deno run -`), staying fully in-memory with no disk I/O
3. **📁 Large Script Support** — Scripts >= 2MB automatically use a temp file (cleaned up after execution)
4. **🔒 Permission Control** — Translates permission options to Deno's security flags
## 📚 API Reference
@@ -198,8 +195,8 @@ const smartDeno = new SmartDeno();
| Method | Description |
|--------|-------------|
| `start(options?)` | Initialize and start SmartDeno |
| `stop()` | Stop SmartDeno and clean up resources |
| `start(options?)` | Initialize SmartDeno (downloads Deno if needed) |
| `stop()` | Stop SmartDeno instance |
| `isRunning()` | Check if SmartDeno is currently running |
| `executeScript(script, options?)` | Execute a Deno script |
@@ -208,7 +205,6 @@ const smartDeno = new SmartDeno();
```typescript
interface ISmartDenoOptions {
forceLocalDeno?: boolean;
port?: number;
}
interface IExecuteScriptOptions {