New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@devbookhq/sdk

Package Overview
Dependencies
Maintainers
2
Versions
152
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@devbookhq/sdk - npm Package Compare versions

Comparing version 0.1.5 to 1.0.0

2

package.json
{
"name": "@devbookhq/sdk",
"version": "0.1.5",
"version": "1.0.0",
"description": "Devbook allows visitors of your docs to interact with and execute any code snippet or shell command in a private VM",

@@ -5,0 +5,0 @@ "homepage": "https://usedevbook.com",

@@ -20,6 +20,6 @@ # Devbook SDK

```tsx
// 1. Import the hook.
// 1. Import the hook
import { useDevbook, Env } from '@devbookhq/sdk'
// 2. Define your code.
// 2. Define your code
const code = `

@@ -30,7 +30,13 @@ > Code that you want to execute in a VM goes here.

function InteractiveCodeSnippet() {
// 3. Use the hook
const { stdout, stderr, runCode } = useDevbook({ env: Env.NodeJS })
function handleRun() {
// 4. Execute the code
runCode(code)
}
return (
<div>
<button onClick={() => runCode(code)}>Run</button>
<button onClick={handleRun}>Run</button>
<h3>Output</h3>

@@ -48,2 +54,3 @@ {stdout.map((o, idx) => <span key={`out_${idx}`}>{o}</span>)}

```ts
// 1. Import the class
import { Devbook, Env } from '@devbookhq/sdk'

@@ -56,13 +63,14 @@

// 3. Define callbacks.
function handleStdout(out: string) {
console.log('stdout', { err })
}
// 3. Create new Devbook instance
const dbk = new Devbook({
env: Env.NodeJS,
onStdout(out) {
console.log('stdout', { err })
},
onStderr(err) {
console.log('stderr', { err })
},
})
function handleStderr(err: string) {
console.log('stderr', { err })
}
// 4. Create new Devbook instance.
const dbk = new Devbook({ env: Env.NodeJS, onStdout: handleStdout, onStderr: handleStderr })
// 4. Execute the code
dbk.runCode(code)

@@ -69,0 +77,0 @@ ```

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc