Class: Daytona::SandboxTsCodeToolbox
- Inherits:
-
Object
- Object
- Daytona::SandboxTsCodeToolbox
- Defined in:
- lib/daytona/code_toolbox/sandbox_ts_code_toolbox.rb
Instance Method Summary collapse
-
#get_run_command(code, params = nil) ⇒ String
Get the run command for executing TypeScript code.
Instance Method Details
#get_run_command(code, params = nil) ⇒ String
Get the run command for executing TypeScript code
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/daytona/code_toolbox/sandbox_ts_code_toolbox.rb', line 12 def get_run_command(code, params = nil) encoded_code = Base64.encode64(code) argv = params&.argv&.join(' ') || '' # Execute TypeScript code using ts-node with ESM support " sh -c 'echo #{encoded_code} | base64 --decode | npx ts-node -O " \ "\"{\\\"module\\\":\\\"CommonJS\\\"}\" -e \"$(cat)\" x #{argv} 2>&1 | grep -vE " \ "\"npm notice\"' " end |