Registry / devops / reveal-compiler-explorer

reveal-compiler-explorer

JSON →
library3.3.0jsnpmunverified

A plugin for reveal.js that integrates the Compiler Explorer (godbolt.org) to display live code compilation and assembly output within presentations. Current stable version 1.6.2 (as of 2021-10-22). The package allows presenters to embed editable code snippets that compile with various compilers (GCC, Clang, MSVC) and show assembly, execution results, and optimizations. Key differentiators include tight integration with reveal.js slide decks, support for multiple languages (C, C++, Rust, etc.), and customizable compiler options. Release cadence appears low with sporadic updates. Compared to standalone Compiler Explorer embeds, this plugin provides seamless navigation and keyboard shortcuts within presentations.

npm install reveal-compiler-explorer
INSTALL
IMPORT
SIG · REVEAL-COMPILER-EX
R
reveal-compiler-explorer
devopsjavascriptv3.3.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.

RevealCompilerExplorer
import RevealCompilerExplorer from 'reveal-compiler-explorer'
const RevealCompilerExplorer = require('reveal-compiler-explorer')
ESM default export. CommonJS require may work depending on bundler but is not officially supported.
RevealCompilerExplorer
const RevealCompilerExplorer = require('reveal-compiler-explorer').default
const RevealCompilerExplorer = require('reveal-compiler-explorer')
When using CommonJS, the default export is under .default. The non-default require returns an object with a default property.
RevealCompilerExplorer
import RevealCompilerExplorer from 'reveal-compiler-explorer'
import { RevealCompilerExplorer } from 'reveal-compiler-explorer'
The package only exports a default export, not a named export. Named import will result in undefined.

Shows how to import the plugin and add it to a reveal.js instance, with optional configuration.

import Reveal from 'reveal.js'; import RevealCompilerExplorer from 'reveal-compiler-explorer'; let deck = new Reveal({ plugins: [ RevealCompilerExplorer ], // Optional: configure the plugin revealCompilerExplorer: { defaultCompiler: 'g82', defaultLanguage: 'c++' } }); deck.initialize();
Debug
Known issues
gotchaThe plugin requires reveal.js version 4.x or higher. Using with older reveal.js versions may cause undefined behavior.
fix
Upgrade reveal.js to version 4 or later.
affects: >=1.0.0
breakingIn version 1.6.0, the default export changed from a named export to a default export. Previously, you had to import { RevealCompilerExplorer } from 'reveal-compiler-explorer'.
fix
Use import RevealCompilerExplorer from 'reveal-compiler-explorer' instead of the named import.
affects: >=1.6.0
deprecatedThe option 'compiler' has been renamed to 'defaultCompiler' in version 1.5.0. Using 'compiler' still works but logs a deprecation warning.
fix
Rename 'compiler' to 'defaultCompiler' in the plugin configuration.
affects: >=1.5.0
Errors
Common errors & fixes
Uncaught TypeError: RevealCompilerExplorer is not a constructor
Using the named import instead of default import in an ESM environment.
fix
Change to import RevealCompilerExplorer from 'reveal-compiler-explorer'
Cannot find module 'reveal-compiler-explorer'
Package not installed or not added to dependencies.
fix
Run npm install reveal-compiler-explorer
The plugin 'RevealCompilerExplorer' is not a function.
Using default import with CommonJS require without accessing .default.
fix
Use const RevealCompilerExplorer = require('reveal-compiler-explorer').default
Upgrade
Version history
3.3.0latest on npm
Audit
Dependencies
reveal.jsrequiredThe plugin requires reveal.js to be loaded as a presentation framework. It hooks into reveal.js's plugin system.
Agent activity
7 hits · last 30 days
node
6
OpenAI (training)
1
Resources
reveal-compiler-explorer — npm install reveal-compiler-explorer · libregistry