Registry / web-framework / repl-sdk

repl-sdk

JSON →
library1.6.0jsnpmunverified

repl-sdk is a runtime compiler library for building fast, extensible REPLs and interactive playgrounds in the browser. Current stable version is 1.6.0, released in April 2026 as part of the ember-repl monorepo. It uses es-module-shims and supports JavaScript, React, Vue, Svelte, Ember, Glimdown, and Mermaid out of the box. Key differentiators: on-demand async compilation (only pay for what you compile for), nested language support within Markdown, and a flexible plugin API for adding custom compilers/renderers. Unlike alternatives like CodeSandbox or RunKit, repl-sdk is designed for embedding in web apps with minimal overhead and full control over the compilation pipeline.

npm install repl-sdk
INSTALL
IMPORT
SIG · REPL-SDK
R
repl-sdk
web-frameworkjavascriptv1.6.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

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

repl-sdk
import { createReplSdk } from 'repl-sdk'
const replSdk = require('repl-sdk')
ESM-only package; CommonJS require is not supported.
buildCompiler
import { buildCompiler } from 'repl-sdk'
import { Compiler } from 'repl-sdk'
Since v1.4.0, buildCompiler replaces the deprecated Compiler class.
markdownCompiler
import { markdownCompiler } from 'repl-sdk'
Exposed since v1.3.0. Returns a promise of a compiler module.

Creates a REPL SDK instance, compiles a simple JavaScript expression, and logs the resulting code.

import { createReplSdk } from 'repl-sdk'; async function main() { const sdk = await createReplSdk(); const output = await sdk.compile({ code: `console.log('Hello, REPL!')`, language: 'javascript', }); console.log(output.code); } main();
Debug
Known issues
breakingESM-only: repl-sdk does not support CommonJS require(). Attempting to use require() will throw an error.
fix
Use ES module import: import { ... } from 'repl-sdk'
affects: >=1.0.0
breakingbuildCompiler replaces Compiler class: The Compiler class export was removed in v1.4.0.
fix
Use buildCompiler() instead: import { buildCompiler } from 'repl-sdk'
affects: >=1.4.0
deprecatedNested language support may not work with all compiler combinations; the API for adding custom compilers is experimental.
fix
Refer to documentation for adding custom compilers; expect possible breaking changes in minor versions.
affects: >=1.0.0
gotchaAsync compilation: compile() is async and returns a promise. Forgetting to await will lead to undefined behavior.
fix
Always await the compilation result.
affects: >=1.0.0
Errors
Common errors & fixes
SyntaxError: Cannot use import statement outside a module
Using repl-sdk with a script tag or without type="module".
fix
Add type="module" to your script tag: <script type="module" src="app.js"></script>
TypeError: replSdk.compile is not a function
Trying to call compile() on a non-initialized or promised sdk instance before resolution.
fix
Ensure createReplSdk() is awaited: const sdk = await createReplSdk();
Module not found: Error: Can't resolve 'es-module-shims'
Missing es-module-shims peer dependency.
fix
Install es-module-shims: npm install es-module-shims
TypeError: Cannot read properties of undefined (reading 'compile')
Calling compile on a misconfigured or missing sdk object.
fix
Verify that createReplSdk() resolves and assign it correctly.
Upgrade
Version history
1.6.0latest on npm
Audit
Dependencies
es-module-shimsrequiredRequired for shimming ES module imports in the browser
Agent activity
7 hits · last 30 days
node
6
OpenAI (training)
1
Resources
repl-sdk — npm install repl-sdk · libregistry