Skip to content

Releases: plainbrew/next-utils

@plainbrew/next-typed-href@0.6.0

Choose a tag to compare

@github-actions github-actions released this 03 Jun 04:31
874cbe7

Minor Changes

  • #82 30d6ba9 Thanks @akameco! - feat: require explicit type arguments on .routes()

    defineTypedHref.routes() and defineTypedHrefWithNuqs.routes() now require
    explicit <Routes, RouteParamsMap> type arguments. Calling them without type
    arguments fails with a TypeScript error at the call site — previously
    Routes would silently widen to string, defeating the type-safety the
    library promises.

    // ❌ Type error AT this line:
    //    "Expected 1 arguments, but got 0."
    //    Hover shows the missing parameter's name and message.
    defineTypedHref.routes();
    
    // ✅ OK
    defineTypedHref.routes<Routes, RouteParamsMap>();

    The mechanism is a conditional rest parameter: when string extends Routes
    (i.e. no type argument was supplied), routes requires a single phantom
    argument whose name and type spell out the fix. When Routes is a proper
    literal union, the rest tuple is empty and the call is nullary as before.

    This is a type-level change only — no runtime behavior changes. Existing
    callers that already pass explicit type arguments are unaffected.

@plainbrew/next-typed-href@0.5.0

Choose a tag to compare

@github-actions github-actions released this 27 May 01:26
2ef0847

Minor Changes

  • #83 a39a62b Thanks @amotarao! - feat: add branded option to return TypedHref branded type from $href()

@plainbrew/next-typed-href@0.4.0

Choose a tag to compare

@github-actions github-actions released this 26 May 04:27
a18c0a3

Minor Changes

  • #61 5882460 Thanks @akameco! - refactor: replace triple-curry with builder pattern, add .withOptions()

    Breaking changes

    Both defineTypedHref and defineTypedHrefWithNuqs now use a builder pattern
    inspired by tRPC's initTRPC.context<T>().create().

    defineTypedHref

    // before
    defineTypedHref<Routes, RouteParamsMap>();
    
    // after
    defineTypedHref.routes<Routes, RouteParamsMap>();

    defineTypedHrefWithNuqs

    // before
    defineTypedHrefWithNuqs<Routes, RouteParamsMap>()(nuqsMap);
    defineTypedHrefWithNuqs<Routes, RouteParamsMap>()({
      requiredSearchParams: true,
    })(nuqsMap);
    
    // after
    defineTypedHrefWithNuqs.routes<Routes, RouteParamsMap>().nuqs(nuqsMap);
    defineTypedHrefWithNuqs
      .routes<Routes, RouteParamsMap>()
      .withOptions({ requiredSearchParams: true })
      .nuqs(nuqsMap);

    New feature: .withOptions()

    requiredSearchParams: true を渡すと、nuqs パーサーが定義されているルートで searchParams が必須になる。

    • .withDefault() なし → フィールドが required(null は渡せる)
    • .withDefault() あり → フィールドが optional
    const { $href } = defineTypedHrefWithNuqs
      .routes<Routes, RouteParamsMap>()
      .withOptions({ requiredSearchParams: true })
      .nuqs({
        "/search": {
          q: parseAsString, // required (no withDefault)
          page: parseAsInteger.withDefault(1), // optional (has withDefault)
        },
      });
    
    $href({ route: "/search", searchParams: { q: "hello" } }); // OK
    $href({ route: "/search" }); // Type error: searchParams is required
    $href({ route: "/search", searchParams: { page: 2 } }); // Type error: q is required

@plainbrew/next-typed-href@0.3.0

Choose a tag to compare

@github-actions github-actions released this 30 Apr 03:34
2c5d400

Minor Changes

  • #58 34f31df Thanks @amotarao! - feat(nuqs): add requiredSearchParams option to defineTypedHrefWithNuqs

    Breaking change

    defineTypedHrefWithNuqs is now a 3-level curried function. An options call has been inserted as the second level:

    // before
    defineTypedHrefWithNuqs<Routes, RouteParamsMap>()(nuqsMap);
    
    // after
    defineTypedHrefWithNuqs<Routes, RouteParamsMap>()()(nuqsMap);

    New feature

    Pass { requiredSearchParams: true } in the second call to enforce that searchParams is provided for routes with nuqs parsers defined.

    Fields without .withDefault() become required; fields with .withDefault() remain optional.

    const { $href } = defineTypedHrefWithNuqs<Routes, RouteParamsMap>()({
      requiredSearchParams: true,
    })({
      "/search": {
        q: parseAsString, // required
        page: parseAsInteger.withDefault(1), // optional
      },
    });
    
    $href({ route: "/search", searchParams: { q: "hello" } }); // OK
    $href({ route: "/search", searchParams: { q: "hello", page: 2 } }); // OK
    $href({ route: "/search" }); // Type error
    $href({ route: "/search", searchParams: { page: 2 } }); // Type error

@plainbrew/vercel-basic-auth@0.2.1

Choose a tag to compare

@github-actions github-actions released this 28 Apr 01:21
75a2f81

Patch Changes

@plainbrew/next-typed-href@0.2.1

Choose a tag to compare

@github-actions github-actions released this 28 Apr 01:21
75a2f81

Patch Changes

@plainbrew/next-typed-href@0.2.0

Choose a tag to compare

@github-actions github-actions released this 21 Apr 03:31
d368011

Minor Changes

  • #28 4b54edb Thanks @amotarao! - feat: Add defineTypedHrefWithNuqs for type-safe searchParams with nuqs parsers

  • #46 eaeb183 Thanks @amotarao! - fix: Support withDefault parsers in defineTypedHrefWithNuqs; null is now a type error for non-nullable params, and values equal to the default are omitted from the URL

Patch Changes

  • #27 100e61f Thanks @amotarao! - chore: Extract path generation logic into a shared helper with no changes to public interface

  • #47 b70eee1 Thanks @amotarao! - refactor: move RouteHasParams/SearchParamsFor/PathOptionsFor types inside defineTypedHrefWithNuqs closure

@plainbrew/next-typed-href@0.1.0

Choose a tag to compare

@github-actions github-actions released this 06 Apr 05:44
9493bb1

Minor Changes

@plainbrew/vercel-basic-auth@0.2.0

Choose a tag to compare

@github-actions github-actions released this 26 Mar 02:55
c7a6d22

Minor Changes

  • #19 42585e3 Thanks @amotarao! - feat: allow username/password to be undefined and throw an error when they are empty or undefined while basic auth is applied

Patch Changes

  • #18 99399ee Thanks @amotarao! - fix: improve Authorization header parsing to validate Basic scheme and handle colons in passwords correctly.

  • #20 55233ba Thanks @amotarao! - test: add tests

@plainbrew/vercel-basic-auth@0.1.2

Choose a tag to compare

@github-actions github-actions released this 25 Mar 23:38
bf05712

Patch Changes