
Security News
MCP Community Begins Work on Official MCP Metaregistry
The MCP community is launching an official registry to standardize AI tool discovery and let agents dynamically find and install MCP servers.
babel-plugin-transform-inline-helpers
Advanced tools
Babel plugin to inline simple static `const` variables or TypeScript type guard functions that are only one line when a leading comment contains `@inline`.
Babel plugin to inline simple static const
variables or TypeScript type guard functions that are only one line when a leading comment contains @inline
.
This plugin was written to make working on Preact easier. It is not intended to be a full blown inlining solution or anything. There will likely be no support outside of the use case we have for Preact.
npm install --save-dev babel-plugin-transform-inline-helpers
Configuration in your babel.config.js
:
const fs = require("fs");
const path = require("path");
// Path to file with helpers that should be inlined
const inlineFile = path.join(__dirname, "path/to/my-helpers.js");
const inlineCode = fs.readFileSync(inlineFile, "utf-8");
module.exports = function () {
return {
plugins: [
"babel-plugin-transform-inline-helpers",
{
inlineCode,
},
],
};
};
helper.js
:
/** @inline */
export const FOO = 2;
/** @inline */
export const addTwo = (x) => x + 2;
/** @inline */
export function addTwo2(x) {
return x + 2;
}
import { addTwo } from "./helper.js";
const num = 42;
console.log(addTwo(num));
...becomes:
const num = 42;
console.log(num + 2);
MIT, see the LICENSE file.
FAQs
Babel plugin to inline simple static `const` variables or TypeScript type guard functions that are only one line when a leading comment contains `@inline`.
We found that babel-plugin-transform-inline-helpers 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
The MCP community is launching an official registry to standardize AI tool discovery and let agents dynamically find and install MCP servers.
Research
Security News
Socket uncovers an npm Trojan stealing crypto wallets and BullX credentials via obfuscated code and Telegram exfiltration.
Research
Security News
Malicious npm packages posing as developer tools target macOS Cursor IDE users, stealing credentials and modifying files to gain persistent backdoor access.