Registry / devops / codesandbox-api

codesandbox-api

JSON →
library0.0.32jsnpmunverified

Library for creating custom integrations and protocols with CodeSandbox, version 0.0.32 (stable, low release cadence). Provides APIs to communicate between sandbox frames and the editor, including protocol definitions, event handling, and utilities for building sandbox-level features. Differentiates from direct postMessage by offering typed abstractions and conventions. Ships TypeScript type definitions. Active development within the CodeSandbox monorepo.

npm install codesandbox-api
INSTALL
IMPORT
SIG · CODESANDBOX-API
C
codesandbox-api
devopsjavascriptv0.0.32
Install
—
Import
—
Disk
—
Pass rate
0/ 6
Env Coverage0 / 6
glibc
18–22
musl
18–22
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18–226 runs
build_error
glibc
node 18–226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

sandboxUrl
✓ import { sandboxUrl } from 'codesandbox-api'
Main export for constructing sandbox URLs; ESM-only as no CJS bundle is provided in the package.
constructor
✓ import { constructor } from 'codesandbox-api'
✗ const { constructor } = require('codesandbox-api')
Exports the internal 'constructor' function (unclear usage, likely a helper).
default
✓ import codesandbox from 'codesandbox-api'
✗ import { default } from 'codesandbox-api'
Default export is the main module; named 'default' is not exported separately.
listen
✓ import { listen } from 'codesandbox-api/dist/actions'
Some utilities are in subpath exports; check the dist folder for available actions.

Shows how to use the sandboxUrl function to create a CodeSandbox link from a GitHub repository.

import { sandboxUrl } from 'codesandbox-api'; // Generate a sandbox URL from a GitHub repo const url = sandboxUrl({ github: { repo: 'facebook/react', branch: 'main' }, file: '/src/App.js' }); console.log(url); // https://codesandbox.io/s/github/facebook/react/tree/main?file=/src/App.js
Debug
Known issues
deprecatedVersion 0.x is pre-1.0; APIs may break without major version bump.
fix
Pin to exact version and test upgrades; prefer latest 0.x patch.
affects: <1.0.0
gotchaPackage contains minimal documentation; many exports are undocumented.
fix
Refer to source code or CodeSandbox client for usage examples; consider using source map.
affects: <=0.0.32
gotchaESM-only: No CommonJS build; using require() will not work.
fix
Use dynamic import() in Node or configure bundler for ESM.
affects: >=0.0.1
gotchaSubpath exports: Some utilities are in dist/ subdirectories (e.g., actions).
fix
Import from specific subpath like 'codesandbox-api/dist/actions'.
affects: <=0.0.32
Errors
Common errors & fixes
Cannot find module 'codesandbox-api'
Package is not installed or is missing from node_modules.
fix
Run: npm install codesandbox-api
SyntaxError: Cannot use import statement outside a module
Using ESM import in a CommonJS environment without transpilation.
fix
Add "type": "module" to package.json, or use a bundler like webpack/rollup.
Upgrade
Version history
0.0.32latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
18 hits · last 30 days
node
16
Anthropic
1
OpenAI (training)
1
Resources
codesandbox-api — npm install codesandbox-api · libregistry