Skip to content

Releases: tatethurston/nextjs-routes

v1.0.1

18 Nov 03:43
d3e8af7
Compare
Choose a tag to compare

1.0.1

  • Update NextRouter type to keep query and pathname bound in a union. This allows you to use router from useRouter as an argument to router.push or router.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

11 Nov 19:02
38da772
Compare
Choose a tag to compare

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

08 Nov 22:04
d09ebd1
Compare
Choose a tag to compare

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

Full Changelog: v0.1.6...v0.1.7

v0.1.6

29 Oct 00:20
679174b
Compare
Choose a tag to compare

0.1.6

  • Accept path strings for static routes:

    <Link href="/foo">Foo</Link>

    Thanks @MariaSolOs for the contribution!

  • Use function overloads for Link and router.push and router.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

18 Oct 17:29
f0e1ade
Compare
Choose a tag to compare

0.1.5

  • Export Locale from nextjs-routes.

    import { Locale } from "nextjs-routes";

New Contributors

Full Changelog: v0.1.4...v0.1.5

v0.1.4

11 Oct 20:33
Compare
Choose a tag to compare

0.1.4

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

06 Oct 17:50
Compare
Choose a tag to compare

0.1.3

  • nextjs-routes pageExtensions has been updated to respect multiple extensions such as .page.tsx. In 0.1.2, only single extensions .tsx were respected. This is now identical behavior to Next.js. Thanks @Elindorath!

New Contributors

Full Changelog: v0.1.2...v0.1.3

v0.1.2

05 Oct 21:54
554d367
Compare
Choose a tag to compare

0.1.2

Full Changelog: v0.1.1...v0.1.2

v0.1.1

05 Oct 21:44
4c3e7a1
Compare
Choose a tag to compare

0.1.1

[skipped]

v0.1.0

27 Sep 23:09
9171055
Compare
Choose a tag to compare

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 new outDir option. It also now includes an ESM export to support usage in next.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 the Query for a given Route. This is useful as the context type parameter inside getStaticProps and getServerSideProps. Thanks @MariaSolOs for the contribution!

  • withRoutes now accepts outDir as a configuration option to dictate where nextjs-routes.d.ts is generated. Thanks @MariaSolOs for the contribution!

New Contributors

Full Changelog: v0.0.22...v0.1.0