Releases: tatethurston/nextjs-routes
v1.0.1
1.0.1
-
Update
NextRouter
type to keepquery
andpathname
bound in a union. This allows you to userouter
fromuseRouter
as an argument torouter.push
orrouter.replace
:const router = useRouter(); // reload the current page, preserving search parameters router.push(router, undefined, { locale: "fr" });
Full Changelog: v1.0.0...v1.0.1
v1.0.0
1.0.0
-
This library will now follow semantic versioning.
-
The previously deprecated direct invocation of nextjs-routes via
npx nextjs-routes
has been removed in favor of automatic regeneration via withRoutes. See #63 for the motivation behind this change or to voice any concerns.
Full Changelog: v0.1.7...v1.0.0
v0.1.7
0.1.7
-
Support Next 13 app (beta) directory
-
Add
dir
option to support non standard NextJS project structures such as Nx:// next.config.js const withRoutes = require("nextjs-routes/config")({ dir: __dirname });
Thanks @alexgorbatchev for the contribution!
New Contributors
- @alexgorbatchev made their first contribution in #91
Full Changelog: v0.1.6...v0.1.7
v0.1.6
0.1.6
-
Accept path strings for static routes:
<Link href="/foo">Foo</Link>
Thanks @MariaSolOs for the contribution!
-
Use function overloads for
Link
androuter.push
androuter.replace
. This yields better hints for typos in pathnames:<Link href={{ pathname: "/foosy/[foo]" }}>Foo</Link>
Previously:
[tsserver 2322] [E] Type '"/foos/[foo]"' is not assignable to type '"/"'.
Now:
Type '"/foosy/[foo]"' is not assignable to type '"/api/hello" | "/bars/[bar]" | "/foos/[foo]" | "/"'. Did you mean '"/foos/[foo]"'?
(+2 other overload errors).
Full Changelog: v0.1.5...v0.1.6
v0.1.5
0.1.5
-
Export
Locale
fromnextjs-routes
.import { Locale } from "nextjs-routes";
New Contributors
Full Changelog: v0.1.4...v0.1.5
v0.1.4
0.1.4
nextjs-routes
now generates route types for Nextjs i18n configuration. Eg the following next config:
module.exports = withRoutes({
i18n: {
defaultLocale: "de-DE",
locales: ["de-DE", "en-FR", "en-US"],
},
});
Will make locale
typed as 'de-DE' | 'en-FR' | 'en-US'
for Link
and useRouter
.
Full Changelog: v0.1.3...v0.1.4
v0.1.3
0.1.3
nextjs-routes
pageExtensions has been updated to respect multiple extensions such as.page.tsx
. In0.1.2
, only single extensions.tsx
were respected. This is now identical behavior to Next.js. Thanks @Elindorath!
New Contributors
- @Elindorath made their first contribution in #79
Full Changelog: v0.1.2...v0.1.3
v0.1.2
0.1.2
nextjs-routes
now respects pageExtensions fromnext.config.js
.
Full Changelog: v0.1.1...v0.1.2
v0.1.1
0.1.1
[skipped]
v0.1.0
0.1.0
This release contains a breaking change, indicated by the minor version bump to 0.1.0. nextjs-routes
has not yet reached v1, but will follow semantic versioning once it does. Until then, minor version changes will be used to help flag breaking changes.
- Breaking change: the
withRoutes
import path and invocation has changed to better align with the general pattern in the Nextjs plugin ecosystem and to support configuration options, notably the newoutDir
option. It also now includes an ESM export to support usage innext.config.mjs
.
- const { withRoutes } = require("nextjs-routes/next-config.cjs");
+ const withRoutes = require("nextjs-routes/config")();
/** @type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: true,
};
module.exports = withRoutes(nextConfig);
Note the import path has changed and the import itself has changed to function that is invoked with any configuration options. This provides better ergonomics for configuration options:
const withRoutes = require("nextjs-routes/config")({ outDir: "types" });
-
The type
RoutedQuery
has been added to retrieve theQuery
for a givenRoute
. This is useful as the context type parameter insidegetStaticProps
andgetServerSideProps
. Thanks @MariaSolOs for the contribution! -
withRoutes
now acceptsoutDir
as a configuration option to dictate wherenextjs-routes.d.ts
is generated. Thanks @MariaSolOs for the contribution!
New Contributors
- @MariaSolOs made their first contribution in #67
Full Changelog: v0.0.22...v0.1.0