cloudflare-next-intl 0.6.3 → 0.6.4

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,13 +1,26 @@
1
1
  import type { ErrorHandlingParams } from '../types/types';
2
2
  import { type ReportErrorConfig } from './report_error';
3
3
  /**
4
- * Creates a `"use server"` action that reports a client-originated error via
5
- * `reportError`, so `config` (and anything it closes over — secrets,
4
+ * Builds a function that reports a client-originated error via
5
+ * `reportError`, meant to be re-exported directly from your OWN
6
+ * `"use server"` file so `config` (and anything it closes over — secrets,
6
7
  * `Secrets.telegramBotToken`-style env reads inside your `onError`) never
7
- * has to be imported into client-side code. Call this once (server-side,
8
- * e.g. next to your `RoutingConfig`) and pass the returned function to
9
- * client components that need to report an error — they only ever handle
10
- * the error value itself, never `config`.
8
+ * has to be imported into client-side code:
9
+ *
10
+ * ```ts
11
+ * // report_client_error.ts
12
+ * "use server";
13
+ * import createServerErrorAction from "cloudflare-next-intl/createServerErrorAction";
14
+ * import intlConfig from "./intl_config";
15
+ * export const reportClientError = createServerErrorAction(intlConfig);
16
+ * ```
17
+ *
18
+ * This function itself must NOT be called from a file marked `"use server"`
19
+ * — Next.js requires every top-level export of such a file to be an async
20
+ * function directly; a factory that returns one doesn't qualify. Put
21
+ * `"use server"` in your OWN file (as above), not in a file that calls
22
+ * `createServerErrorAction` and re-exports its result under a different
23
+ * name than a plain `const`.
11
24
  *
12
25
  * The error is stringified before crossing the client→server action
13
26
  * boundary (Next.js server actions serialize arguments; an `Error` instance
@@ -1,14 +1,26 @@
1
- "use server";
2
1
  import reportError from './report_error';
3
2
  import stringifyUnknown from './stringify_unknown';
4
3
  /**
5
- * Creates a `"use server"` action that reports a client-originated error via
6
- * `reportError`, so `config` (and anything it closes over — secrets,
4
+ * Builds a function that reports a client-originated error via
5
+ * `reportError`, meant to be re-exported directly from your OWN
6
+ * `"use server"` file so `config` (and anything it closes over — secrets,
7
7
  * `Secrets.telegramBotToken`-style env reads inside your `onError`) never
8
- * has to be imported into client-side code. Call this once (server-side,
9
- * e.g. next to your `RoutingConfig`) and pass the returned function to
10
- * client components that need to report an error — they only ever handle
11
- * the error value itself, never `config`.
8
+ * has to be imported into client-side code:
9
+ *
10
+ * ```ts
11
+ * // report_client_error.ts
12
+ * "use server";
13
+ * import createServerErrorAction from "cloudflare-next-intl/createServerErrorAction";
14
+ * import intlConfig from "./intl_config";
15
+ * export const reportClientError = createServerErrorAction(intlConfig);
16
+ * ```
17
+ *
18
+ * This function itself must NOT be called from a file marked `"use server"`
19
+ * — Next.js requires every top-level export of such a file to be an async
20
+ * function directly; a factory that returns one doesn't qualify. Put
21
+ * `"use server"` in your OWN file (as above), not in a file that calls
22
+ * `createServerErrorAction` and re-exports its result under a different
23
+ * name than a plain `const`.
12
24
  *
13
25
  * The error is stringified before crossing the client→server action
14
26
  * boundary (Next.js server actions serialize arguments; an `Error` instance
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cloudflare-next-intl",
3
- "version": "0.6.3",
3
+ "version": "0.6.4",
4
4
  "description": "Optimized Next Intl Package Special for App Router and Cloudflare",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",