
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.
This module can be use to mock the results of a native ES6 import in Node.js.
$ npm i -D esmload
$ node --experimental-modules --loader esmload <index.mjs>
'TEST_MOCK'
:import { main, TEST_MOCK } from './lib1.mjs';
TEST_MOCK
is a map:
// lib1.mjs
export function main() {
return 'hello World!';
}
// index.mjs
import { main, TEST_MOCK } from './lib1.mjs';
console.log(main()); // prints 'hello World!'
const mainProxyHandler = TEST_MOCK.get('main');
mainProxyHandler.apply = function(target, self, args) {
return Reflect.apply(target, self, args) + '!!';
}
console.log(main()); // prints 'hello World!!!'
mainProxyHandler.apply = undefined;
console.log(main()); // prints 'hello World!'
See tests for other examples.
Right now, you can't mock something that is not an object.
This is a PoC I just wrote in a couple hours. Next steps may include:
FAQs
Node.js ES6 loader to mock imports
We found that esmload 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.