@farm.js/bot 0.1.0-beta.1 → 0.1.0-beta.2

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.
package/README.md CHANGED
@@ -232,7 +232,7 @@ It returns every problem as a sentence: a secret in the browser config, a `verif
232
232
 
233
233
  ## Limits
234
234
 
235
- - **Server components in `rsc` mode.** Farm runs only a plugin's browser hooks there, not its `configure`, so the build has no widget for `<BotCheck>` and the page logs a `BotError` that says so. A production server doesn't load farm.config.ts either, so `verifyBot` throws a `BotError`, although `farm dev` finds the plugin. To check forms on the server, create the plugin in a module your routes import, such as `src/bot.ts`, and add that instance to `plugins`. `islands` mode works.
235
+ - **Server components in `rsc` mode with `@farm.js/core` 0.1.67 or earlier.** A production server there doesn't load farm.config.ts, so `verifyBot` throws a `BotError`, although `farm dev` finds the plugin. To check forms on the server, create the plugin in a module your routes import, such as `src/bot.ts`, and add that instance to `plugins`. `rsc` mode also skips the plugin's `configure`, so the build has no widget for `<BotCheck>`. Upgrade core, or use `islands` mode.
236
236
  - **Cloudflare Pages with `@farm.js/core` 0.1.66 or earlier.** That output exposes no bindings at runtime, so secrets aren't found and every check fails with a `BotError`. Upgrade core, or use compatibility date `2025-04-01` or later, the `cloudflare-module` preset, or pass `secretKey`.
237
237
  - **reCAPTCHA** means the v2 checkbox. v3 has no widget, so it needs its own provider.
238
238
  - **One checker per app.** The plugin can be added once, so two forms can't use two different checkers.
package/dist/client.js CHANGED
@@ -74,7 +74,7 @@ function withTokenField(driver, name) {
74
74
  export async function startBotWidget(create, start) {
75
75
  // The placeholder `@farm.js/bot/provider-widget` exports, in place of the provider's widget.
76
76
  if (create === Symbol.for("@farm.js/bot/no-widget")) {
77
- throw new BotError("missing_plugin", `This build has no widget for "${start.widget}". The bot plugin's \`configure\` hook adds it, and \`experimental.serverComponents\` in \`rsc\` mode doesn't run that hook yet. Use \`islands\` mode.`);
77
+ throw new BotError("missing_plugin", `This build has no widget for "${start.widget}". The bot plugin's \`configure\` hook adds it, so add \`bot()\` to \`plugins\` in farm.config.ts. \`experimental.serverComponents\` in \`rsc\` mode skips that hook with \`@farm.js/core\` 0.1.67 or earlier.`);
78
78
  }
79
79
  if (typeof create !== "function") {
80
80
  throw new TypeError(`"${start.widget}" must have \`defineBotWidget(...)\` as its default export.`);
package/dist/server.js CHANGED
@@ -8,7 +8,7 @@ import { getBotVerifier } from "./runtime.js";
8
8
  export async function verifyBot(input, options) {
9
9
  const verify = getBotVerifier();
10
10
  if (!verify) {
11
- throw new BotError("missing_plugin", "`verifyBot()` found no bot plugin. Add `bot({ provider })` to `plugins` in farm.config.ts. A production server in `rsc` mode doesn't load farm.config.ts, so there create the plugin in a module your route imports and call its `verify` instead.");
11
+ throw new BotError("missing_plugin", "`verifyBot()` found no bot plugin. Add `bot({ provider })` to `plugins` in farm.config.ts. With `@farm.js/core` 0.1.67 or earlier, a production server in `rsc` mode doesn't load farm.config.ts, so there create the plugin in a module your route imports and call its `verify` instead.");
12
12
  }
13
13
  return verify(input, options);
14
14
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@farm.js/bot",
3
- "version": "0.1.0-beta.1",
3
+ "version": "0.1.0-beta.2",
4
4
  "description": "Stop bots at your forms, with any checker",
5
5
  "keywords": [
6
6
  "bot-protection",
@@ -78,7 +78,7 @@
78
78
  "access": "public"
79
79
  },
80
80
  "dependencies": {
81
- "@farm.js/core": "0.1.67"
81
+ "@farm.js/core": "0.1.68"
82
82
  },
83
83
  "devDependencies": {
84
84
  "@types/node": "^22.20.5",