rpc4next 0.2.8 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- export declare const matchPath: (paths: string[], dynamicKeys: string[]) => (path: string) => {} | null;
1
+ export declare const matchPath: (paths: string[], dynamicKeys: string[]) => (path: string) => Record<string, string | string[] | undefined> | null;
@@ -11,7 +11,7 @@ const matchPath = (paths, dynamicKeys) => {
11
11
  catchAll: "/([^/]+(?:/[^/]+)*)",
12
12
  dynamic: "/([^/]+)",
13
13
  });
14
- // Append /? to match with or without a trailing slash.
14
+ // Add optional trailing slash
15
15
  const match = new RegExp(`^${regexPattern}/?$`).exec(path);
16
16
  if (!match)
17
17
  return null;
@@ -21,10 +21,7 @@ const matchPath = (paths, dynamicKeys) => {
21
21
  const paramValue = (0, utils_1.isCatchAllOrOptional)(key)
22
22
  ? matchValue === undefined || matchValue === ""
23
23
  ? undefined
24
- : matchValue
25
- .split("/")
26
- .filter((segment) => segment.length > 0)
27
- .map((segment) => decodeURIComponent(segment))
24
+ : matchValue.split("/").filter(Boolean).map(decodeURIComponent)
28
25
  : decodeURIComponent(matchValue);
29
26
  return Object.assign(Object.assign({}, acc), { [paramKey]: paramValue });
30
27
  }, {});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rpc4next",
3
- "version": "0.2.8",
3
+ "version": "0.3.0",
4
4
  "description": "Inspired by Hono RPC and Pathpida, rpc4next brings a lightweight and intuitive RPC solution to Next.js, making server-client communication seamless",
5
5
  "author": "watanabe-1",
6
6
  "license": "MIT",