
Security News
AGENTS.md Gains Traction as an Open Format for AI Coding Agents
AGENTS.md is a fast-growing open format giving AI coding agents a shared, predictable way to understand project setup, style, and workflows.
@devtools-ds/console
Advanced tools
The `Console` component emulates the familiar JavaScript REPL experience seen in many browsers. You can customize the function that executes the code, as well as how results are displayed.
The Console
component emulates the familiar JavaScript REPL experience seen in many browsers. You can customize the function that executes the code, as well as how results are displayed.
npm i @devtools-ds/console
# or with yarn
yarn add @devtools-ds/console
Then to use the component in your code just import it!
import { Console } from "@devtools-ds/console";
Render the console, and pass a function to execute an expression.
The result of the execution will display using the ObjectInspector
.
<Console execute={() => {}} />
You can also customize how the results are displayed.
Provide a component with a result
property and it will be used instead.
In browsers, the console displays results using an ObjectInspector
.
This package exports a ConsoleResultInspector
component which mirrors that behavior using @devtools-ds/object-inspector
.
We don't set it as the default resultComponent
for performance reasons; that would cause @devtools-ds/object-inspector
to always be imported even if you don't use it.
import {
Console,
ConsoleExpression,
ConsoleResultInspector,
ConsoleResultProps,
} from "@devtools-ds/console";
/** A custom result component */
export const ConsoleResultCustom = ({ result }: ConsoleResultProps) => {
return <div>{result}</div>;
};
// Use the custom result component
<Console resultComponent={ConsoleResultCustom} />
// Use @devtools-ds/object-inspector
<Console resultComponent={ConsoleResultInspector} />
By default, the Console
component will automatically maintain state for you. If you'd like to control it yourself, you can provide your own history
.
const [history, setHistory] = React.useState<ConsoleExpression[]>([]);
return (
<Console
history={history}
execute={callback((expression: string) => {
const run: ConsoleExpression = {
id: history.length.toString(),
expression,
result: expression,
};
setHistory((oldHistory) => [...oldHistory, run]);
})}
/>
);
Thanks goes to these wonderful people (emoji key):
Adam Dierkens 💻 📖 🎨 | Tyler Krupicka 💻 📖 🎨 🚇 💡 ⚠️ | Andrew Lisowski 💻 |
This project follows the all-contributors specification. Contributions of any kind welcome!
FAQs
The `Console` component emulates the familiar JavaScript REPL experience seen in many browsers. You can customize the function that executes the code, as well as how results are displayed.
The npm package @devtools-ds/console receives a total of 63 weekly downloads. As such, @devtools-ds/console popularity was classified as not popular.
We found that @devtools-ds/console demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
AGENTS.md is a fast-growing open format giving AI coding agents a shared, predictable way to understand project setup, style, and workflows.
Security News
/Research
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
Security News
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.