Gathering detailed insights and metrics for @gasket/plugin-nextjs
Gathering detailed insights and metrics for @gasket/plugin-nextjs
Gathering detailed insights and metrics for @gasket/plugin-nextjs
Gathering detailed insights and metrics for @gasket/plugin-nextjs
npm install @gasket/plugin-nextjs
Typescript
Module System
Node Version
NPM Version
@gasket/plugin-git@7.4.3
Updated on Jul 03, 2025
@gasket/plugin-data@7.4.5
Updated on Jul 03, 2025
@gasket/preset-nextjs@7.4.9
Updated on Jul 03, 2025
@gasket/preset-api@7.4.6
Updated on Jul 03, 2025
@gasket/plugin-docs@7.4.4
Updated on Jul 03, 2025
@gasket/react-intl@7.5.4
Updated on Jul 03, 2025
JavaScript (95.29%)
TypeScript (3.24%)
CSS (1.3%)
HTML (0.18%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
138 Stars
1,585 Commits
77 Forks
17 Watchers
36 Branches
78 Contributors
Updated on Jul 10, 2025
Latest Version
7.6.0
Package Id
@gasket/plugin-nextjs@7.6.0
Unpacked Size
79.63 kB
Size
23.03 kB
File Count
55
NPM Version
10.9.2
Node Version
22.16.0
Published on
Jul 10, 2025
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
2
3
37
This plugin adds Next.js to your application.
npm i @gasket/plugin-nextjs
Update your gasket
file plugin configuration:
1// gasket.js 2 3+ import pluginNextjs from '@gasket/plugin-nextjs'; 4 5export default makeGasket({ 6 plugins: [ 7+ pluginNextjs 8 ] 9});
The GASKET_DEV
environment variable is used to signal the programmatic execution of the Next.js development server when working with a custom Next.js server. Set this variable to a truthy value in order to run the Next.js development server.
1GASKET_DEV=1 npm run local
It is also possible for apps to config Next.js using the gasket.js
file. To do so, specify a nextConfig
object property in the same form as what
you would set for custom configurations or using Next.js plugins.
1// gasket.js 2export default makeGasket({ 3 plugins: [ 4 pluginNextjs 5 ], 6 nextConfig: { 7 poweredByHeader: false, 8 useFileSystemPublicRoutes: false 9 } 10});
In order for Next.js to pick up the configurations, you will need to create a
next.config.js
file in the root of your project and export the results of the
getNextConfig action.
1// next.config.js 2import gasket from './gasket.js'; 3export default gasket.actions.getNextConfig();
For general Webpack configurations, it is recommended to use features of the Gasket Webpack plugin, which will be merged into the Next.js configuration.
When using this plugin along with @gasket/plugin-intl to determine and provide
locale files, be sure to set the i18n config for defaultLocale
and supported
locales
in the intl
plugin config, instead of the nextConfig
. This will be
used by the Gasket Intl plugin, and also passed along with the Next config for
i18n routing.
1// gasket.js 2export default makeGasket({ 3 intl: { 4+ defaultLocale: 'en-US', 5+ locales: ['en-US', 'fr', 'nl-NL'] 6 }, 7 nextConfig: { 8 i18n: { 9- locales: ['en-US', 'fr', 'nl-NL'], 10- defaultLocale: 'en-US', 11 domains: [ 12 { 13 domain: 'example.com', 14 defaultLocale: 'en-US', 15 }, 16 { 17 domain: 'example.nl', 18 defaultLocale: 'nl-NL', 19 }, 20 { 21 domain: 'example.fr', 22 defaultLocale: 'fr', 23 }, 24 ], 25 } 26 } 27});
Also note when using @gasket/plugin-intl to determine the locale, that the
NEXT_LOCALE
cookie will have no effect. You can, of course, hook the intlLocale
lifecycle in an app to enable that behavior if desired.
When creating a new application with this plugin, you will be prompted with a question in the CLI asking if you would like to add a sitemap to your application.
Answering yes to this question will install next-sitemap
as a dependency,
generate a next-sitemap.config.js file, and add a sitemap
npm script to your
package.json. next-sitemap
is an npm package that generates sitemaps and a
robots.txt file for Next.js applications. Learn more by reading the next-sitemap docs.
This action returns the current nextConfig
object
which allows plugins to configure the Next.js application.
Place this in a next.config.js
file which Next.js will load.
1// next.config.js 2 3import gasket from './gasket.js'; 4export default gasket.actions.getNextConfig();
This action is intended for use in server contexts where you need to know how a request will route to a Next.js page. This async function returns null if the manifest could not be parsed or if the requested URL does not match a route. If a match is found, an object with these properties is returned:
Property | Type | Description |
---|---|---|
page | String | The page name/path used to identify a page within next.js |
regex | RegExp | The regular expression that matches URLs to the page |
routeKeys | Object | For dynamic routes the mapping of URL placeholders to parsed route parameters |
namedRegex | RegExp | Like regex , but named capturing groups are included to populate dynamic routing parameters |
1import gasket from '../gasket.js'; 2 3async function someMiddleware(req, res, next) { 4 const route = await gasket.actions.getNextRoute(); 5 if (route) { 6 const { groups } = req.url.match(route.namedRegex); 7 console.log(`Matched ${route.page} with parameters`, groups); 8 } 9 10 next(); 11}
Executed when the next
server has been created. It will receive a reference to
the created next
instance.
1export default { 2 name: 'sample-plugin', 3 hooks: { 4 /** 5 * Modify the Next app instance 6 * @param {Gasket} gasket The Gasket API 7 * @param {Next} next Next app instance 8 */ 9 next: function next(gasket, next) { 10 next.setAssetPrefix('https://my.cdn.com/dir/'); 11 } 12 } 13};
Executed before the next
server has been created. It will receive a reference
to the next
config. This will allow you to modify the next
config before the
next
server is created.
1export default { 2 name: 'sample-plugin', 3 hooks: { 4 /** 5 * Modify the Next config 6 * @param {Gasket} gasket The Gasket API 7 * @param {Object} config Next config 8 * @returns {Object} config 9 */ 10 nextConfig(gasket, config) { 11 return { 12 ...config, 13 modification: 'newValue' 14 }; 15 } 16 } 17};
Provides access to both next
and express
instances which allows
next.render
calls in express-based routes.
1export default { 2 name: 'sample-plugin', 3 hooks: { 4 nextExpress: function (gasket, { next, express }) { 5 express.post('/contact-form', (req, res) => { 6 // DO STUFF WITH RECEIVED DATA 7 // 8 // And once we're done, we can `next.render` to render the `pages/thanks` 9 // file as a response. 10 next.render(req, res, '/thanks', req.params); 11 }); 12 } 13 } 14};
Provides access to both next
and fastify
instances which allows
next.render
calls in express-based routes.
1export default { 2 name: 'sample-plugin', 3 hooks: { 4 nextFastify: function (gasket, { next, fastify }) { 5 fastify.post('/contact-form', (req, res) => { 6 // DO STUFF WITH RECEIVED DATA 7 // 8 // And once we're done, we can `next.render` to render the `pages/thanks` 9 // file as a response. 10 next.render(req, res, '/thanks', req.params); 11 }); 12 } 13 } 14};
Enables execution of custom logic just prior to an HTTP request being handed to next.js for processing. Hooks receive the request, response, and next server (not to be confused with the next function used by express-like middleware):
1export default {
2 name: 'sample-plugin',
3 hooks: {
4 async nextPreHandling(gasket, {
5 req,
6 res,
7 nextServer
8 }) {
9 await doPreRenderingLogic(req, res);
10 }
11 }
12};
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
30 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 10
Reason
license file detected
Details
Reason
no binaries found in the repo
Reason
security policy file detected
Details
Reason
Found 17/19 approved changesets -- score normalized to 8
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
project is not fuzzed
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
21 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More