
Research
Malicious npm Packages Impersonate Flashbots SDKs, Targeting Ethereum Wallet Credentials
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
. . . ,-. .
|\ | | / |
| \| ,-. ,-| ,-. | ,-. ;-. ,-. ,-. | ,-.
| | | | | | |-' \ | | | | `-. | | | |-'
' ' `-' `-' `-' `-' `-' ' ' `-' `-' ' `-'
Have you missed a good repl while developing a Node.js project?
Use node-nc to easily configure your project's console (similar to rails c).
Just type node-nc in any of your project's folder.
$ npm install -g node-nc
$ node-nc # or nc
nc > reload(false) // reloads all global files without reload nc by default
nc > .reload false // same as above
nc > $module$ // the path that is required when using module
nc > module // the module
It is intended to be used inside Node.js projects.
The nc command can also be invoked from a projects subfolder.
If used outside a project it will not globalize any file and will save history to ~/.nc_history
(~/${config.historyFileName}
).
This module extends Node.js basic repl functionality:
const defaultConf = {
useGlobal: false, // Repl useGlobal. If set to true all globals will be inside nc namespace.
useAsync: false, // Experimental use of await in repl for node versions that don't support top level await.
globalizeFiles: true, // Make all project files global.
globalizeDependencies: true, // Globalize projects dependencies.
useNcFile: true, // Use nc.js file if it exists.
usePackageFile: true, // Use package file to determine prompt, root folter and dependencies.
writeHistoryFile: true, // Write all commands to a file.
historyFileName: '.nc_history', // The history filename. An absolute path can also be given.
suggestParams: true // Experimental suggestion of params when calling a function
};
Configuration can be overwitten
by env variables:
NC_USE_GLOBAL, NC_USE_ASYNC, NC_GLOBALIZE_FILES, NC_GLOBALIZE_DEPENDENCIES, NC_USE_NC_FILE, NC_USE_PACKAGE_FILE, NC_WRITE_HISTORY_FILE, NC_HISTORY_FILE_NAME, NC_SUGGEST_PARAMS or
by using an nc.js file. This file can also be used to make some project initializations Eg. connect to a database, declare some global vars etc. In nc.js a method setConfig(options) is available to overwrite the default configurations. Note that NC_USE_NC_FILE env variable must not be false.
Example of a simple nc.js file:
// overwrite useGlobal
setConfig({ useGlobal:true });.
// connect to db
mongoose.connect(mongooseDb, options, function (err, data) {});
If you have a very complicated expression (many nested expresssions) it is better to split it in two:
// Bad
await Compicated-Epression
// Good
const promise = Complicated-expression
await promise;
This way await will work as expected.
When you type a parenthesis repl will try to figure out if the previous expression is a function and suggest its parameters.
Test a function's performance using the buildin profiler. The function can return a promise.
node-nc> profiler(() => fib(10))
Function ()=> fib(10) ran 40,770 times in 995.99 ms
node-nc> await profiler(() => fib(20))
Function ()=> fib(20) ran 328 times in 942.71 ms
node-nc> await profiler(() => Promise.resolve(true), () => {})
Run function ()=> Promise.resolve(true) 171,784 times in 1020.95 ms
Run function ()=>{} 111,795,737 times in 1007.90 ms
FAQs
Node console. A rails inspired command line for node.
We found that node-nc 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.
Research
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
Security News
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Security News
Following last week’s supply chain attack, Nx published findings on the GitHub Actions exploit and moved npm publishing to Trusted Publishers.