Nimpl News 06/2024
@nimpl/getters improvement
In get-params
, you can now pass options for obtaining parameters in specific conditions:
ignoreDifferenceError
- In case of error or segments difference, the getter will return null (e.g., /_not-found
could be at /it/removed-page
and it would not have any params)
pathname
- Custom pathname (e.g., ["/example/custom"]
). Usable for rewritten pages in SSR or custom functions
pagePaths
- Custom pagePaths list (e.g., ["/example/[slug]/page"]
). Usable for rewritten pages in SSR or custom functions
https://github.com/vordgi/nimpl-getters/pull/80
@nimpl/classnames-minifier improvements
The package synchronizes with the next.js cache. However, under unknown circumstances, there is a possibility that the cache in next.js will not update when the package expects it to. To avoid this, an experimental function for limiting copies has been added (https://github.com/vordgi/classnames-minifier/issues/35 , https://github.com/vordgi/nimpl-classnames-minifier/issues/102 ).
module.exports = async (phase) => {
const classnamesMinifierWrapper = classnamesMinifier({
experimental: {
freedNamesPolicy: 'block',
},
});
return classnamesMinifierWrapper(nextConfig);
};
If you have encountered such situations - please write them as a package issue with a description of how to reproduce.
@nimpl/middleware-chain improvements
Now each chain element supports path rules for which it should work https://github.com/vordgi/nimpl-middleware-chain/issues/15
export default chain([
[intlMiddleware, { exclude: /^\/private(\/.*)?$/ }],
() => {
const next = new NextResponse();
next.cookies.set("custom-cookie", Date.now().toString());
return next;
},
[nextAuth, { include: /^\/private(\/.*)?$/ }],
]);
New package - @nimpl/router
Edge router for next.js apps. Allows you to configure rewrites, redirects, i18n and basePath at the middleware level instead of next.config.js.
import { createMiddleware } from '@nimpl/router';
export const middleware = createMiddleware({
redirects: [
{
source: '/old',
destination: '/',
permanent: false,
},
],
rewrites: [
{
source: '/home',
destination: '/',
locale: false,
},
],
basePath: '/doc',
i18n: {
defaultLocale: 'en',
locales: ['en', 'de'],
},
});
inio improvements
Updated service homepage - inio.nimpl.tech
Many improvements to make the editor even faster, more convenient, and more useful
ni-105 support multiple patterns
ni-79 pagination and count on page logic
Thanks to @zakidze for many new ideas!
Documentation Changes
Improvements in documentation: