
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
A comprehensive AST-based function inliner for reducing code complexity and flattening nested function calls.
export class D {
constructor() {
this._super_C_constructor();
console.log('d');
}
_super_A_constructor() {
console.log('a');
}
_super_B_constructor() {
this._super_A_constructor();
console.log('b');
}
_super_C_constructor() {
this._super_B_constructor();
console.log('c');
}
}
export class D {
constructor() {
console.log('a');
console.log('b');
console.log('c');
console.log('d');
}
}
import { inline } from './inliner.js';
import { readFileSync } from 'fs';
const code = readFileSync('./your-file.js', 'utf-8');
const inlinedCode = await inline(code);
console.log(inlinedCode);
Analyzes which functions call which, and counts how many times each function is called.
Identifies functions called exactly once as candidates for inlining.
Sorts functions so that dependencies are inlined first (leaves to root).
For each inlined function:
Generates clean, formatted code using astring and prettier.
Original:
function validate(value) {
if (value < 0) {
return false;
}
if (value > 100) {
return false;
}
return true;
}
Inlined:
let result$1;
let returned_result$1 = false;
if (!returned_result$1) {
if (num < 0) {
result$1 = false;
returned_result$1 = true;
}
}
if (!returned_result$1) {
if (num > 100) {
result$1 = false;
returned_result$1 = true;
}
}
if (!returned_result$1) {
result$1 = true;
}
Original:
function shadowTest() {
const temp = 5;
const result = helper(temp);
return result;
}
function helper(x) {
const temp = x + 10; // Shadows outer temp
return temp;
}
Inlined:
function shadowTest() {
const temp = 5;
const temp$1 = temp + 10; // Renamed to avoid conflict
const result = temp$1;
return result;
}
// _reusable_log is called 3 times, so it's NOT inlined
_reusable_log(message) {
console.log('[LOG]', message);
}
method1() {
this._reusable_log('From method1');
return 1;
}
method2() {
this._reusable_log('From method2');
return 2;
}
From the test module:
_reusable_log, _multiple_a)ScopeTracker: Manages variable bindings and generates unique namesCallGraphAnalyzer: Builds call graph and counts function usageSimpleVariableRenamer: Renames variables to avoid conflictsParameterSubstituter: Replaces parameter references with argumentsReturnHandler: Transforms return statements for inliningInliner: Main orchestrator that coordinates the inlining processcall, apply) are not trackedacorn: JavaScript parserastring: AST to code generatorprettier: Code formatterMIT
FAQs
Function inliner for reducing code complexity
We found that exfoliate demonstrated a healthy version release cadence and project activity because the last version was released less than 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
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.