![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
babel-plugin-transform-hook-names
Advanced tools
Babel plugin to add hook names for Preact devtools
A babel plugin to automatically infer hook names from your code and show them in the Preact Devtools extension.
Before:
After:
Requires: Babel >= 7.12
Install babel-plugin-transform-hook-names
in your project:
npm install --save-dev babel-plugin-transform-hook-names
# or via yarn
yarn add -D babel-plugin-transform-hook-names
Then add it to your babel configuration:
{
"plugins": ["babel-plugin-transform-hook-names"]
}
The way it works is that each hook is wrapped with a function that is passed the same name as the variable:
Input:
// Works for "preact/compat" or "react" too
import { useState, useReducer, useRef } from "preact/hooks";
function Foo() {
const [text, setText] = useState("hello");
const [counter, increment] = useReducer(c => c + 1, 0);
const rootElement = useRef();
const memo = useMemo(() => text.toUpperCase(), ["text"]);
}
Output:
import { addHookName } from "preact/devtools";
import { useState, useReducer, useRef } from "preact/hooks";
function Foo() {
const [text, setText] = addHookName(useState("hello"), "text");
const [counter, increment] = addHookName(
useReducer(c => c + 1, 0),
"counter",
);
const rootElement = addHookName(useRef(), "rootElement");
const memo = addHookName(
useMemo(() => text.toUpperCase(), ["text"]),
"memo",
);
}
MIT, see the LICENSE file
FAQs
Babel plugin to add hook names for Preact devtools
The npm package babel-plugin-transform-hook-names receives a total of 62,441 weekly downloads. As such, babel-plugin-transform-hook-names popularity was classified as popular.
We found that babel-plugin-transform-hook-names demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 9 open source maintainers 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
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.