A nifty tool that lets you run JavaScript directly from your text editor. You select some code, then press a keyboard shortcut to run it. Anything from the merest expression to a whole module may be evaluated at a time.
It can evaluate JavaScript in many environments, including:
It integrates with many text editors, including:
It supports JavaScript's module syntax (ESM). It does not support CommonJS (and never will).
It is free and open source.
The ability to easily run fragments of code (and even whole modules) in isolation is good for application development, learning, and casual scripting.
Traditionally, JavaScript code is only ever executed as part of an application or unit test suite. Buried deep within an application, code is difficult to exercise and debug. Bugs are a natural consequence of such code because it is not well understood.
Replete makes it possible to “reach into” a codebase and begin interacting with code immediately. Removing the execution barrier shortens the feedback loop, improves understanding of the code, and encourages experimentation. Code written in this way tends to have fewer bugs and is more fun to work with.
Replete is a robust, performant, and general tool that is designed for everyday use by JavaScripters of all kinds. It is suitable for writing code for the browser, for the server, or both. Running the same code in multiple browsers and runtimes is trivial with Replete, making it easier to produce portable code.
There is a Playground where you can try Replete without installing anything. It contains a basic tutorial and many examples, as well as a fun surprise.
The easiest way to get Replete running in your text editor is to first install Deno, then install a text editor plugin (video). At this point you should be able to begin evaluating code in the browser and Deno (video).
To evaluate code in other runtimes, such as Node.js, you will first need to configure the plugin by supplying --which_node
or similar. Basic configuration options are listed here and expanded upon here.
If you do not wish to install Deno, Replete also runs on Node.js and Bun. But this requires that the Replete repository be cloned locally and the plugin be configured appropriately.
Replete evaluates import.meta.main
as true
. You can use this fact to embed demos in your modules, turning them into programs that demonstrate their own correctness. This technique is called Whole Modules.
Languages that transpile to JavaScript, such as Microsoft's TypeScript, are also supported. It just takes some extra configuration.
My name is James Diacono and I'm a full-time Web programmer. You can:
The source code for Replete lives at github.com/jamesdiacono/Replete.