@freestyle-sh/with-python
Advanced tools
+3
-3
@@ -1,2 +0,2 @@ | ||
| import { VmWith, VmWithInstance, CreateVmOptions } from 'freestyle-sandboxes'; | ||
| import { VmWith, VmWithInstance, VmSpec } from 'freestyle-sandboxes'; | ||
| import { VmRunCodeInstance, JSONValue, RunCodeResponse, VmRunCode } from '@freestyle-sh/with-type-run-code'; | ||
@@ -6,3 +6,3 @@ | ||
| constructor(); | ||
| configure(existingConfig: CreateVmOptions): CreateVmOptions | Promise<CreateVmOptions>; | ||
| configureSnapshotSpec(spec: VmSpec): VmSpec; | ||
| createInstance(): PythonRuntimeInstance; | ||
@@ -13,3 +13,3 @@ } | ||
| constructor(builder: VmPython); | ||
| runCode<Result extends JSONValue = any>({ code, }: { | ||
| runCode<Result extends JSONValue = any>(args: string | { | ||
| code: string; | ||
@@ -16,0 +16,0 @@ }): Promise<RunCodeResponse<Result>>; |
+8
-9
@@ -1,2 +0,2 @@ | ||
| import { VmWith, VmTemplate, VmWithInstance } from 'freestyle-sandboxes'; | ||
| import { VmWith, VmSpec, VmWithInstance } from 'freestyle-sandboxes'; | ||
@@ -7,9 +7,9 @@ class VmPython extends VmWith { | ||
| } | ||
| configure(existingConfig) { | ||
| const pythonConfig = { | ||
| template: new VmTemplate({ | ||
| configureSnapshotSpec(spec) { | ||
| return this.composeSpecs( | ||
| spec, | ||
| new VmSpec({ | ||
| aptDeps: ["python3"] | ||
| }) | ||
| }; | ||
| return this.compose(existingConfig, pythonConfig); | ||
| ); | ||
| } | ||
@@ -26,5 +26,4 @@ createInstance() { | ||
| } | ||
| async runCode({ | ||
| code | ||
| }) { | ||
| async runCode(args) { | ||
| const code = typeof args === "string" ? args : args.code; | ||
| const result = await this.vm.exec({ | ||
@@ -31,0 +30,0 @@ command: `python3 -c "${code.replace(/"/g, '\\"')}"` |
+3
-3
| { | ||
| "name": "@freestyle-sh/with-python", | ||
| "version": "0.2.0", | ||
| "version": "0.2.1", | ||
| "private": false, | ||
| "dependencies": { | ||
| "freestyle-sandboxes": "^0.1.2", | ||
| "@freestyle-sh/with-type-run-code": "^0.2.0" | ||
| "freestyle-sandboxes": "^0.1.8", | ||
| "@freestyle-sh/with-type-run-code": "^0.2.1" | ||
| }, | ||
@@ -9,0 +9,0 @@ "type": "module", |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
2312
-2.2%62
-1.59%1
Infinity%