
Security News
PodRocket Podcast: Inside the Recent npm Supply Chain Attacks
Socket CEO Feross Aboukhadijeh discusses the recent npm supply chain attacks on PodRocket, covering novel attack vectors and how developers can protect themselves.
@unic/estatico-utils
Advanced tools
Utilities for logging etc.
$ npm install --save-dev @unic/estatico-utils
const parseArgs = require('minimist');
const { Logger } = require('@unic/estatico-utils');
const env = parseArgs(process.argv.slice(2));
// Create instance of logger for specific plugin
const logger = new Logger('estatico-bla');
// Log info
logger.info('Something is happening');
// Log debug info, only logged if "-LLLL" is set
logger.debug('Something is happening', /* Additional log info */);
// Log error, will exit process unless env.dev is true
logger.error(new Error('Something went wrong'), env.dev);
const { Plugin } = require('@unic/estatico-utils');
// Set up details, schema and task
// …
module.exports = (options, env = {}) => new Plugin({
defaults,
schema,
options,
task,
env,
});
Compares files resolved from fileGlob
with current files in results/
directory.
const test = require('ava');
const utils = require('@unic/estatico-utils').test;
test.cb('default', (t) => {
task(defaults)().on('end', () => utils.compareFiles(t, path.join(__dirname, 'expected/default/*')));
});
Join everything sinon.spy
captured into string, strip ANSI characters and line-breaks.
const test = require('ava');
const sinon = require('sinon');
const utils = require('@unic/estatico-utils').test;
test.cb('error', (t) => {
const spy = sinon.spy(console, 'log');
task(defaults)().on('end', () => {
spy.restore();
const log = utils.stripLogs(spy);
t.regex(log, /test\/fixtures\/error.hbs Parse error on line 2/);
t.end();
});
});
Serve unchanged files from in-memory cache.
const { readFileSyncCached } = require('@unic/estatico-utils');
// First read will go to file system
console.log(readFileSyncCached('/path/to/my/file.ext'));
// Second request will be served from cache unless the file has changed in the meantime
// fs.statSync('/path/to/my/file.ext').mtime.getTime() is used as reference
console.log(readFileSyncCached('/path/to/my/file.ext'));
Apache 2.0.
FAQs
Utilities for logging etc.
The npm package @unic/estatico-utils receives a total of 9 weekly downloads. As such, @unic/estatico-utils popularity was classified as not popular.
We found that @unic/estatico-utils demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 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
Socket CEO Feross Aboukhadijeh discusses the recent npm supply chain attacks on PodRocket, covering novel attack vectors and how developers can protect themselves.
Security News
Maintainers back GitHub’s npm security overhaul but raise concerns about CI/CD workflows, enterprise support, and token management.
Product
Socket Firewall is a free tool that blocks malicious packages at install time, giving developers proactive protection against rising supply chain attacks.