@computesdk/codesandbox 1.5.7 → 1.5.8
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 +18 -18
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -17,20 +17,16 @@ npm install @computesdk/codesandbox
|
|
|
17
17
|
export CSB_API_KEY=your_api_key_here
|
|
18
18
|
```
|
|
19
19
|
|
|
20
|
-
##
|
|
20
|
+
## Quick Start
|
|
21
21
|
|
|
22
|
-
###
|
|
22
|
+
### Gateway Mode (Recommended)
|
|
23
23
|
|
|
24
|
-
|
|
25
|
-
import { createCompute } from 'computesdk';
|
|
26
|
-
import { codesandbox } from '@computesdk/codesandbox';
|
|
24
|
+
Use the gateway for zero-config auto-detection:
|
|
27
25
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
provider: codesandbox({ apiKey: process.env.CSB_API_KEY })
|
|
31
|
-
});
|
|
26
|
+
```typescript
|
|
27
|
+
import { compute } from 'computesdk';
|
|
32
28
|
|
|
33
|
-
//
|
|
29
|
+
// Auto-detects CodeSandbox from CSB_API_KEY environment variable
|
|
34
30
|
const sandbox = await compute.sandbox.create();
|
|
35
31
|
|
|
36
32
|
// Execute JavaScript/Node.js code
|
|
@@ -66,24 +62,28 @@ console.log(pythonResult.stdout);
|
|
|
66
62
|
// }
|
|
67
63
|
// Running in: CodeSandbox
|
|
68
64
|
|
|
69
|
-
|
|
70
|
-
await compute.sandbox.destroy(sandbox.sandboxId);
|
|
65
|
+
await sandbox.destroy();
|
|
71
66
|
```
|
|
72
67
|
|
|
73
|
-
### Direct
|
|
68
|
+
### Direct Mode
|
|
69
|
+
|
|
70
|
+
For direct SDK usage without the gateway:
|
|
74
71
|
|
|
75
72
|
```typescript
|
|
76
73
|
import { codesandbox } from '@computesdk/codesandbox';
|
|
77
74
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
apiKey: 'your_api_key',
|
|
75
|
+
const compute = codesandbox({
|
|
76
|
+
apiKey: process.env.CSB_API_KEY,
|
|
81
77
|
templateId: 'universal', // Optional: specify template
|
|
82
78
|
timeout: 600000 // 10 minutes
|
|
83
79
|
});
|
|
84
80
|
|
|
85
|
-
|
|
86
|
-
|
|
81
|
+
const sandbox = await compute.sandbox.create();
|
|
82
|
+
|
|
83
|
+
const result = await sandbox.runCode('console.log("Hello from CodeSandbox!");');
|
|
84
|
+
console.log(result.stdout);
|
|
85
|
+
|
|
86
|
+
await sandbox.destroy();
|
|
87
87
|
```
|
|
88
88
|
|
|
89
89
|
## Configuration
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@computesdk/codesandbox",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.8",
|
|
4
4
|
"description": "CodeSandbox provider for ComputeSDK - fast browser-compatible sandboxes with npm and Python support",
|
|
5
5
|
"author": "Garrison",
|
|
6
6
|
"license": "MIT",
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
],
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"@codesandbox/sdk": "^2.0.7",
|
|
22
|
-
"@computesdk/provider": "1.0.
|
|
23
|
-
"computesdk": "1.10.
|
|
22
|
+
"@computesdk/provider": "1.0.2",
|
|
23
|
+
"computesdk": "1.10.2"
|
|
24
24
|
},
|
|
25
25
|
"keywords": [
|
|
26
26
|
"computesdk",
|