Registry / testing / sql-workbench-embedded

sql-workbench-embedded

JSON →
library0.1.5jsnpmunverified

Lightweight JavaScript library (v0.1.5, MIT) that transforms static HTML SQL code blocks into interactive, browser-based SQL execution environments using DuckDB WASM. All SQL runs client-side—no backend needed. Key differentiators: zero-config auto-init via CSS class, lazy-loaded DuckDB, framework-agnostic (vanilla JS, React, Vue), privacy-first (no external data transmission), custom theming, and init queries for DuckDB extensions. Gzipped bundle is ~9.5 kB. Built with TypeScript, ships types. Compatible with modern browsers supporting WebAssembly.

npm install sql-workbench-embedded
INSTALL
IMPORT
SIG · SQL-WORKBENCH-EMBE
S
sql-workbench-embedded
testingjavascriptv0.1.5
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.

default (UMD)
<script src="https://unpkg.com/sql-workbench-embedded@latest"></script>
<script src="https://cdn.jsdelivr.net/npm/sql-workbench-embedded/index.js"></script>
UMD bundle exposes global `SQLWorkbench`.
SQLWorkbench
import { SQLWorkbench } from 'sql-workbench-embedded';
const SQLWorkbench = require('sql-workbench-embedded');
Package is ESM-first; CJS requires dynamic import or bundler handling.
SQLWorkbench.Embed
const embed = new SQLWorkbench.Embed(element, options);
import { Embed } from 'sql-workbench-embedded';
Embed is not a named export; access via SQLWorkbench.Embed after init.

Shows both automatic initialization via CSS class and manual embedding with theme configuration.

// Install: npm install sql-workbench-embedded import { SQLWorkbench } from 'sql-workbench-embedded'; // Configure globally SQLWorkbench.config({ theme: 'dark', baseUrl: 'https://my-data-server.com', }); // Auto-init all elements with class 'sql-workbench-embedded' SQLWorkbench.init(); // Or manual embed const element = document.querySelector('pre.sql-workbench-embedded'); const embed = new SQLWorkbench.Embed(element, { theme: 'light' }); // Example HTML in your page: // <pre class="sql-workbench-embedded"> // <code>SELECT 'Hello, World!' AS greeting;</code> // </pre> // For CDN usage (no bundler): // <script src="https://unpkg.com/sql-workbench-embedded@latest"></script> // <pre class="sql-workbench-embedded"> // <code>SELECT * FROM generate_series(1,10);</code> // </pre>
Debug
Known issues
breakingRequires peer dependency @duckdb/duckdb-wasm@^1.33.1-dev19.0; incompatible with other versions or missing install causes runtime error.
fix
Install the exact peer dep: npm install @duckdb/duckdb-wasm@^1.33.1-dev19.0
affects: >=0.1.0
breakingESM-only; CommonJS require (require('sql-workbench-embedded')) fails.
fix
Use dynamic import: const { SQLWorkbench } = await import('sql-workbench-embedded'); or switch to ESM.
affects: >=0.1.0
deprecatedCDN reference to @latest is discouraged for production; use specific version to avoid breaking changes.
fix
Replace @latest with a specific version tag like @0.1.4 in script src.
affects: >=0.1.0
gotchaSQLWorkbench.Embed is not a named export; attempting import { Embed } fails with undefined.
fix
Access via SQLWorkbench.Embed after importing the main object.
affects: >=0.1.0
Errors
Common errors & fixes
Uncaught TypeError: Cannot destructure property 'SQLWorkbench' of ... as it is undefined.
Using CommonJS require on an ESM-only package or missing import
fix
Use import { SQLWorkbench } from 'sql-workbench-embedded'; or dynamic import.
Module not found: Error: Can't resolve '@duckdb/duckdb-wasm'
Peer dependency @duckdb/duckdb-wasm not installed
fix
npm install @duckdb/duckdb-wasm@^1.33.1-dev19.0
Uncaught (in promise) TypeError: Failed to fetch dynamically imported module
DuckDB WASM file not accessible or path misconfigured
fix
Ensure baseUrl is set correctly if serving WASM from custom path, or use default CDN.
Upgrade
Version history
0.1.5latest on npm
Audit
Dependencies
@duckdb/duckdb-wasmrequiredRequired for SQL execution via DuckDB WASM
Agent activity
6 hits · last 30 days
node
6
Resources
sql-workbench-embedded — npm install sql-workbench-embedded · libregistry