
Research
/Security News
Weaponizing Discord for Command and Control Across npm, PyPI, and RubyGems.org
Socket researchers uncover how threat actors weaponize Discord across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.
next-plugin-query-cache
Advanced tools
A build-time query cache for Next.js. Works by creating an HTTP server during the build that caches responses.
I made this thing like yesterday. Watch for releases for stability.
npm i next-plugin-query-cache
or
yarn add next-plugin-query-cache
next.config.js
// next.config.js
const { createQueryCachePlugin } = require('next-plugin-query-cache/config');
const withQueryCache = createQueryCachePlugin({
// // optionally provide a fetch implementation
// fetch: require('node-fetch'),
//
// // optionally provide a flag to disable the plugin
// disabled: process.env.DISABLE_QUERY_CACHE,
//
// // optionally provide a binding port for the proxy
// // by default it will bind to a random ephemeral port assigned by the OS
// port: 4000,
});
module.exports = withQueryCache({
// optionally, you can include a next.js config
});
queryFetch
functionIn order to use the query cache, you must make queries via the queryFetch
function.
// query-cache.js
import { createQueryFetch } from 'next-plugin-query-cache';
export default createQueryFetch({
// this must be included. Get the assigned port via `NEXT_QUERY_CACHE_PORT`
port: process.env.NEXT_QUERY_CACHE_PORT,
//
// // optionally provide a fetch implementation
// fetch: window.fetch,
//
// // optionally provide a function to tell whether or not the query cache
// // is enabled. if it returns false, the query cache will not run
// getEnabled: () => true,
//
// // optionally provide a function to determine whether or not the request
// // should be cached
// canBeCached: (url, options) => (options?.method || 'GET') === 'GET',
});
// some-page.js
import queryFetch from '../query-cache';
export const getStaticProps = async (context) => {
// use the query fetch for cached responses during a build
const response = await queryFetch('..');
// ...
return {
props: {
/* ... */
},
};
};
FAQs
A build-time query cache for Next.js.
We found that next-plugin-query-cache 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.
Research
/Security News
Socket researchers uncover how threat actors weaponize Discord across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.
Security News
Socket now integrates with Bun 1.3’s Security Scanner API to block risky packages at install time and enforce your organization’s policies in local dev and CI.
Research
The Socket Threat Research Team is tracking weekly intrusions into the npm registry that follow a repeatable adversarial playbook used by North Korean state-sponsored actors.