almostnode 0.2.0 → 0.2.1
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 +21 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -64,6 +64,26 @@ const result = container.execute(`
|
|
|
64
64
|
console.log(result.exports); // "Hello from the browser!"
|
|
65
65
|
```
|
|
66
66
|
|
|
67
|
+
> **⚠️ Security Warning:** The example above runs code on the main thread with full access to your page. **Do not use `createContainer()` or `container.execute()` with untrusted code.** For untrusted code, use `createRuntime()` with a cross-origin sandbox - see [Sandbox Setup](#sandbox-setup).
|
|
68
|
+
|
|
69
|
+
### Running Untrusted Code Securely
|
|
70
|
+
|
|
71
|
+
```typescript
|
|
72
|
+
import { createRuntime, VirtualFS } from 'almostnode';
|
|
73
|
+
|
|
74
|
+
const vfs = new VirtualFS();
|
|
75
|
+
|
|
76
|
+
// Create a secure runtime with cross-origin isolation
|
|
77
|
+
const runtime = await createRuntime(vfs, {
|
|
78
|
+
sandbox: 'https://your-sandbox.vercel.app', // Deploy with generateSandboxFiles()
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
// Now it's safe to run untrusted code
|
|
82
|
+
const result = await runtime.execute(untrustedCode);
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
See [Sandbox Setup](#sandbox-setup) for deployment instructions.
|
|
86
|
+
|
|
67
87
|
### Working with Virtual File System
|
|
68
88
|
|
|
69
89
|
```typescript
|
|
@@ -836,7 +856,7 @@ triggerHMR('/app/page.tsx', iframe);
|
|
|
836
856
|
### Setup
|
|
837
857
|
|
|
838
858
|
```bash
|
|
839
|
-
git clone https://github.com/
|
|
859
|
+
git clone https://github.com/Macaly/almostnode.git
|
|
840
860
|
cd almostnode
|
|
841
861
|
npm install
|
|
842
862
|
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "almostnode",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "Node.js in your browser. Just like that.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -17,11 +17,11 @@
|
|
|
17
17
|
],
|
|
18
18
|
"repository": {
|
|
19
19
|
"type": "git",
|
|
20
|
-
"url": "https://github.com/
|
|
20
|
+
"url": "https://github.com/Macaly/almostnode.git"
|
|
21
21
|
},
|
|
22
|
-
"homepage": "https://github.com/
|
|
22
|
+
"homepage": "https://github.com/Macaly/almostnode#readme",
|
|
23
23
|
"bugs": {
|
|
24
|
-
"url": "https://github.com/
|
|
24
|
+
"url": "https://github.com/Macaly/almostnode/issues"
|
|
25
25
|
},
|
|
26
26
|
"author": "",
|
|
27
27
|
"engines": {
|