@freestyle-sh/with-uv 0.1.0 → 0.2.0

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 CHANGED
@@ -20,9 +20,9 @@ const { vm } = await freestyle.vms.create({
20
20
  },
21
21
  });
22
22
 
23
- const res = await vm.uv.runCode(
24
- "import json; print(json.dumps({ 'hello': 'world' }))"
25
- );
23
+ const res = await vm.uv.runCode({
24
+ code: "import json; print(json.dumps({ 'hello': 'world' }))"
25
+ });
26
26
 
27
27
  console.log(res);
28
28
  // { result: { hello: 'world' }, stdout: '{"hello": "world"}\n', statusCode: 0 }
@@ -44,7 +44,7 @@ new VmUv({
44
44
 
45
45
  ## API
46
46
 
47
- ### `vm.uv.runCode(code: string)`
47
+ ### `vm.uv.runCode({ code: string })`
48
48
 
49
49
  Executes Python code using uv's managed Python runtime.
50
50
 
package/dist/index.d.ts CHANGED
@@ -19,7 +19,9 @@ declare class VmUv extends VmWith<VmUvInstance> implements VmRunCode<VmRunCodeIn
19
19
  declare class VmUvInstance extends VmWithInstance implements VmRunCodeInstance {
20
20
  builder: VmUv;
21
21
  constructor(builder: VmUv);
22
- runCode<Result extends JSONValue = any>(code: string): Promise<RunCodeResponse<Result>>;
22
+ runCode<Result extends JSONValue = any>({ code, }: {
23
+ code: string;
24
+ }): Promise<RunCodeResponse<Result>>;
23
25
  }
24
26
 
25
27
  export { VmUv };
package/dist/index.js CHANGED
@@ -58,7 +58,9 @@ class VmUvInstance extends VmWithInstance {
58
58
  super();
59
59
  this.builder = builder;
60
60
  }
61
- async runCode(code) {
61
+ async runCode({
62
+ code
63
+ }) {
62
64
  const result = await this.vm.exec({
63
65
  command: `/opt/uv/bin/uv run python -c "${code.replace(/"/g, '\\"')}"`
64
66
  });
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@freestyle-sh/with-uv",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "private": false,
5
5
  "dependencies": {
6
6
  "freestyle-sandboxes": "^0.1.2",
7
- "@freestyle-sh/with-type-run-code": "^0.1.0"
7
+ "@freestyle-sh/with-type-run-code": "^0.2.0"
8
8
  },
9
9
  "type": "module",
10
10
  "main": "./dist/index.js",