diff --git a/.changeset/isbot-version-four.md b/.changeset/isbot-version-four.md new file mode 100644 index 00000000000..44a3a8b6572 --- /dev/null +++ b/.changeset/isbot-version-four.md @@ -0,0 +1,9 @@ +--- +"@remix-run/dev": patch +--- + +Fix issue with `isbot` v4 released on 1/1/2024 + +* `remix dev` wil now add `"isbot": "^4"` to `package.json` instead of using `latest` +* Update built-in `entry.server` files to work with both `isbot@3` and `isbot@4` for backwards-compatibility with Remix apps that have pinned `isbot` to v3 +* Templates are updated to use `isbot@4` moving forward via `create-remix` diff --git a/contributors.yml b/contributors.yml index c78faf52d60..b3e5172e13f 100644 --- a/contributors.yml +++ b/contributors.yml @@ -172,6 +172,7 @@ - fergusmeiklejohn - fernandojbf - fgiuliani +- fifi98 - fishel-feng - francisudeji - frandiox diff --git a/docs/guides/migrating-react-router-app.md b/docs/guides/migrating-react-router-app.md index f6f64132caa..db7f7d1e1a1 100644 --- a/docs/guides/migrating-react-router-app.md +++ b/docs/guides/migrating-react-router-app.md @@ -54,7 +54,7 @@ import type { } from "@remix-run/node"; import { createReadableStreamFromReadable } from "@remix-run/node"; import { RemixServer } from "@remix-run/react"; -import isbot from "isbot"; +import { isbot } from "isbot"; import { renderToPipeableStream } from "react-dom/server"; const ABORT_DELAY = 5_000; @@ -66,7 +66,7 @@ export default function handleRequest( remixContext: EntryContext, loadContext: AppLoadContext ) { - return isbot(request.headers.get("user-agent")) + return isbot(request.headers.get("user-agent") || "") ? handleBotRequest( request, responseStatusCode, diff --git a/docs/guides/typescript.md b/docs/guides/typescript.md index cfd7720efd2..97892eb9d48 100644 --- a/docs/guides/typescript.md +++ b/docs/guides/typescript.md @@ -25,7 +25,7 @@ The Remix compiler will not do any type checking (it simply removes the types). "@remix-run/node": "latest", "@remix-run/react": "latest", "@remix-run/serve": "latest", - "isbot": "^3.6.8", + "isbot": "^4.1.0", "react": "^18.2.0", "react-dom": "^18.2.0" }, diff --git a/docs/start/v2.md b/docs/start/v2.md index ed70ff2060f..784a561aef9 100644 --- a/docs/start/v2.md +++ b/docs/start/v2.md @@ -977,7 +977,7 @@ Remix v2 also no longer exports these polyfilled implementations from `@remix-ru - import { Response } from "@remix-run/node"; // or cloudflare/deno + import { createReadableStreamFromReadable } from "@remix-run/node"; // or cloudflare/deno import { RemixServer } from "@remix-run/react"; - import isbot from "isbot"; + import { isbot } from "isbot"; import { renderToPipeableStream } from "react-dom/server"; const ABORT_DELAY = 5_000; diff --git a/integration/defer-test.ts b/integration/defer-test.ts index 0a6f07df465..488f744a810 100644 --- a/integration/defer-test.ts +++ b/integration/defer-test.ts @@ -985,7 +985,7 @@ test.describe("aborted", () => { import type { AppLoadContext, EntryContext } from "@remix-run/node"; import { createReadableStreamFromReadable } from "@remix-run/node"; import { RemixServer } from "@remix-run/react"; - import isbot from "isbot"; + import { isbot } from "isbot"; import { renderToPipeableStream } from "react-dom/server"; const ABORT_DELAY = 1; @@ -997,7 +997,7 @@ test.describe("aborted", () => { remixContext: EntryContext, loadContext: AppLoadContext ) { - return isbot(request.headers.get("user-agent")) + return isbot(request.headers.get("user-agent") || "") ? handleBotRequest( request, responseStatusCode, diff --git a/integration/helpers/vite-template/package.json b/integration/helpers/vite-template/package.json index ac20019f64e..96b017221a0 100644 --- a/integration/helpers/vite-template/package.json +++ b/integration/helpers/vite-template/package.json @@ -12,7 +12,7 @@ "@remix-run/node": "*", "@remix-run/react": "*", "@remix-run/serve": "*", - "isbot": "^3.6.8", + "isbot": "^4.1.0", "react": "^18.2.0", "react-dom": "^18.2.0" }, diff --git a/integration/package.json b/integration/package.json index cd226fc5470..a42db375ddc 100644 --- a/integration/package.json +++ b/integration/package.json @@ -21,7 +21,7 @@ "get-port": "^5.1.1", "glob": "8.0.3", "globby": "^11.1.0", - "isbot": "^3.6.8", + "isbot": "^4.1.0", "npm-run-all": "^4.1.5", "pidtree": "^0.6.0", "postcss": "^8.4.19", diff --git a/packages/remix-dev/__tests__/fixtures/cloudflare/package.json b/packages/remix-dev/__tests__/fixtures/cloudflare/package.json index 8dfca642d73..c644afccb87 100644 --- a/packages/remix-dev/__tests__/fixtures/cloudflare/package.json +++ b/packages/remix-dev/__tests__/fixtures/cloudflare/package.json @@ -13,7 +13,7 @@ "@remix-run/cloudflare-pages": "*", "@remix-run/css-bundle": "*", "@remix-run/react": "*", - "isbot": "^3.6.8", + "isbot": "^4.1.0", "react": "^18.2.0", "react-dom": "^18.2.0" }, diff --git a/packages/remix-dev/__tests__/fixtures/deno/.vscode/resolve_npm_imports.json b/packages/remix-dev/__tests__/fixtures/deno/.vscode/resolve_npm_imports.json index ca2ae22b5d0..af7431c1ee9 100644 --- a/packages/remix-dev/__tests__/fixtures/deno/.vscode/resolve_npm_imports.json +++ b/packages/remix-dev/__tests__/fixtures/deno/.vscode/resolve_npm_imports.json @@ -13,7 +13,7 @@ "@remix-run/dev/server-build": "https://esm.sh/@remix-run/dev@1.16.0/server-build", "@remix-run/react": "https://esm.sh/@remix-run/react@1.16.0", "@remix-run/server-runtime": "https://esm.sh/@remix-run/server-runtime@1.16.0", - "isbot": "https://esm.sh/isbot@^3.6.8", + "isbot": "https://esm.sh/isbot@^4.1.0", "react": "https://esm.sh/react@^18.2.0", "react-dom": "https://esm.sh/react-dom@^18.2.0", "react-dom/client": "https://esm.sh/react-dom@^18.2.0/client", diff --git a/packages/remix-dev/__tests__/fixtures/deno/package.json b/packages/remix-dev/__tests__/fixtures/deno/package.json index 476a4bc088f..86785541fef 100644 --- a/packages/remix-dev/__tests__/fixtures/deno/package.json +++ b/packages/remix-dev/__tests__/fixtures/deno/package.json @@ -16,7 +16,7 @@ "@remix-run/css-bundle": "*", "@remix-run/deno": "*", "@remix-run/react": "*", - "isbot": "^3.6.8", + "isbot": "^4.1.0", "react": "^18.2.0", "react-dom": "^18.2.0" }, diff --git a/packages/remix-dev/__tests__/fixtures/node/package.json b/packages/remix-dev/__tests__/fixtures/node/package.json index 25e975e9ab1..26280f9db3c 100644 --- a/packages/remix-dev/__tests__/fixtures/node/package.json +++ b/packages/remix-dev/__tests__/fixtures/node/package.json @@ -13,7 +13,7 @@ "@remix-run/node": "*", "@remix-run/react": "*", "@remix-run/serve": "*", - "isbot": "^3.6.8", + "isbot": "^4.1.0", "react": "^18.2.0", "react-dom": "^18.2.0" }, diff --git a/packages/remix-dev/config.ts b/packages/remix-dev/config.ts index bc97d243ed3..bb78f13005f 100644 --- a/packages/remix-dev/config.ts +++ b/packages/remix-dev/config.ts @@ -493,7 +493,7 @@ export async function resolveConfig( pkgJson.update({ dependencies: { ...pkgJson.content.dependencies, - isbot: "latest", + isbot: "^4", }, }); diff --git a/packages/remix-dev/config/defaults/entry.server.cloudflare.tsx b/packages/remix-dev/config/defaults/entry.server.cloudflare.tsx index 327c51f0dca..e7bb7a4f4f8 100644 --- a/packages/remix-dev/config/defaults/entry.server.cloudflare.tsx +++ b/packages/remix-dev/config/defaults/entry.server.cloudflare.tsx @@ -1,6 +1,6 @@ import type { AppLoadContext, EntryContext } from "@remix-run/cloudflare"; import { RemixServer } from "@remix-run/react"; -import isbot from "isbot"; +import * as isbotModule from "isbot"; import { renderToReadableStream } from "react-dom/server"; export default async function handleRequest( @@ -22,7 +22,7 @@ export default async function handleRequest( } ); - if (isbot(request.headers.get("user-agent"))) { + if (isBotRequest(request.headers.get("user-agent"))) { await body.allReady; } @@ -32,3 +32,24 @@ export default async function handleRequest( status: responseStatusCode, }); } + +// We have some Remix apps in the wild already running with isbot@3 so we need +// to maintain backwards compatibility even though we want new apps to use +// isbot@4. That way, we can ship this as a minor Semver update to @remix-run/dev. +function isBotRequest(userAgent: string | null) { + if (!userAgent) { + return false; + } + + // isbot >= 3.8.0, >4 + if ("isbot" in isbotModule && typeof isbotModule.isbot === "function") { + return isbotModule.isbot(userAgent); + } + + // isbot < 3.8.0 + if ("default" in isbotModule && typeof isbotModule.default === "function") { + return isbotModule.default(userAgent); + } + + return false; +} diff --git a/packages/remix-dev/config/defaults/entry.server.deno.tsx b/packages/remix-dev/config/defaults/entry.server.deno.tsx index b6f81d4cca8..cef1e72d970 100644 --- a/packages/remix-dev/config/defaults/entry.server.deno.tsx +++ b/packages/remix-dev/config/defaults/entry.server.deno.tsx @@ -1,6 +1,6 @@ import type { AppLoadContext, EntryContext } from "@remix-run/deno"; import { RemixServer } from "@remix-run/react"; -import isbot from "isbot"; +import * as isbotModule from "isbot"; import { renderToReadableStream } from "react-dom/server"; export default async function handleRequest( @@ -22,7 +22,7 @@ export default async function handleRequest( } ); - if (isbot(request.headers.get("user-agent"))) { + if (isBotRequest(request.headers.get("user-agent"))) { await body.allReady; } @@ -32,3 +32,24 @@ export default async function handleRequest( status: responseStatusCode, }); } + +// We have some Remix apps in the wild already running with isbot@3 so we need +// to maintain backwards compatibility even though we want new apps to use +// isbot@4. That way, we can ship this as a minor Semver update to @remix-run/dev. +function isBotRequest(userAgent: string | null) { + if (!userAgent) { + return false; + } + + // isbot >= 3.8.0, >4 + if ("isbot" in isbotModule && typeof isbotModule.isbot === "function") { + return isbotModule.isbot(userAgent); + } + + // isbot < 3.8.0 + if ("default" in isbotModule && typeof isbotModule.default === "function") { + return isbotModule.default(userAgent); + } + + return false; +} diff --git a/packages/remix-dev/config/defaults/entry.server.node.tsx b/packages/remix-dev/config/defaults/entry.server.node.tsx index d41e6da7282..5005bc69178 100644 --- a/packages/remix-dev/config/defaults/entry.server.node.tsx +++ b/packages/remix-dev/config/defaults/entry.server.node.tsx @@ -3,7 +3,7 @@ import { PassThrough } from "node:stream"; import type { AppLoadContext, EntryContext } from "@remix-run/node"; import { createReadableStreamFromReadable } from "@remix-run/node"; import { RemixServer } from "@remix-run/react"; -import isbot from "isbot"; +import * as isbotModule from "isbot"; import { renderToPipeableStream } from "react-dom/server"; const ABORT_DELAY = 5_000; @@ -15,7 +15,7 @@ export default function handleRequest( remixContext: EntryContext, loadContext: AppLoadContext ) { - return isbot(request.headers.get("user-agent")) + return isBotRequest(request.headers.get("user-agent")) ? handleBotRequest( request, responseStatusCode, @@ -30,6 +30,27 @@ export default function handleRequest( ); } +// We have some Remix apps in the wild already running with isbot@3 so we need +// to maintain backwards compatibility even though we want new apps to use +// isbot@4. That way, we can ship this as a minor Semver update to @remix-run/dev. +function isBotRequest(userAgent: string | null) { + if (!userAgent) { + return false; + } + + // isbot >= 3.8.0, >4 + if ("isbot" in isbotModule && typeof isbotModule.isbot === "function") { + return isbotModule.isbot(userAgent); + } + + // isbot < 3.8.0 + if ("default" in isbotModule && typeof isbotModule.default === "function") { + return isbotModule.default(userAgent); + } + + return false; +} + function handleBotRequest( request: Request, responseStatusCode: number, diff --git a/scripts/playground/template/app/entry.server.tsx b/scripts/playground/template/app/entry.server.tsx index 26cfbe282a3..9e8354f7991 100644 --- a/scripts/playground/template/app/entry.server.tsx +++ b/scripts/playground/template/app/entry.server.tsx @@ -2,7 +2,7 @@ import { PassThrough } from "node:stream"; import type { AppLoadContext, EntryContext } from "@remix-run/node"; import { createReadableStreamFromReadable } from "@remix-run/node"; import { RemixServer } from "@remix-run/react"; -import isbot from "isbot"; +import { isbot } from "isbot"; import { renderToPipeableStream } from "react-dom/server"; const ABORT_DELAY = 5000; @@ -14,7 +14,7 @@ export default function handleRequest( remixContext: EntryContext, loadContext: AppLoadContext ) { - let callbackName = isbot(request.headers.get("user-agent")) + let callbackName = isbot(request.headers.get("user-agent") || "") ? "onAllReady" : "onShellReady"; diff --git a/scripts/playground/template/package.json b/scripts/playground/template/package.json index 9ed64c5ff06..6bc8cc88c87 100644 --- a/scripts/playground/template/package.json +++ b/scripts/playground/template/package.json @@ -26,7 +26,7 @@ "bcryptjs": "^2.4.3", "express": "^4.18.1", "get-port": "^6.1.2", - "isbot": "^3.5.1", + "isbot": "^4.1.0", "morgan": "^1.10.0", "react": "^18.2.0", "react-dom": "^18.2.0", diff --git a/templates/arc/app/entry.server.tsx b/templates/arc/app/entry.server.tsx index e2002b0740e..45db3229c68 100644 --- a/templates/arc/app/entry.server.tsx +++ b/templates/arc/app/entry.server.tsx @@ -9,7 +9,7 @@ import { PassThrough } from "node:stream"; import type { AppLoadContext, EntryContext } from "@remix-run/node"; import { createReadableStreamFromReadable } from "@remix-run/node"; import { RemixServer } from "@remix-run/react"; -import isbot from "isbot"; +import { isbot } from "isbot"; import { renderToPipeableStream } from "react-dom/server"; const ABORT_DELAY = 5_000; @@ -24,7 +24,7 @@ export default function handleRequest( // eslint-disable-next-line @typescript-eslint/no-unused-vars loadContext: AppLoadContext ) { - return isbot(request.headers.get("user-agent")) + return isbot(request.headers.get("user-agent") || "") ? handleBotRequest( request, responseStatusCode, diff --git a/templates/arc/package.json b/templates/arc/package.json index 91d8e08eacb..94c454ac445 100644 --- a/templates/arc/package.json +++ b/templates/arc/package.json @@ -15,7 +15,7 @@ "@remix-run/node": "*", "@remix-run/react": "*", "cross-env": "^7.0.3", - "isbot": "^3.6.8", + "isbot": "^4.1.0", "react": "^18.2.0", "react-dom": "^18.2.0", "source-map-support": "^0.5.21" diff --git a/templates/cloudflare-pages/app/entry.server.tsx b/templates/cloudflare-pages/app/entry.server.tsx index 3f5b9989333..0d5c40a755e 100644 --- a/templates/cloudflare-pages/app/entry.server.tsx +++ b/templates/cloudflare-pages/app/entry.server.tsx @@ -6,7 +6,7 @@ import type { AppLoadContext, EntryContext } from "@remix-run/cloudflare"; import { RemixServer } from "@remix-run/react"; -import isbot from "isbot"; +import { isbot } from "isbot"; import { renderToReadableStream } from "react-dom/server"; export default async function handleRequest( @@ -31,7 +31,7 @@ export default async function handleRequest( } ); - if (isbot(request.headers.get("user-agent"))) { + if (isbot(request.headers.get("user-agent") || "")) { await body.allReady; } diff --git a/templates/cloudflare-pages/package.json b/templates/cloudflare-pages/package.json index ee3120f5819..23379c1ab3e 100644 --- a/templates/cloudflare-pages/package.json +++ b/templates/cloudflare-pages/package.json @@ -14,7 +14,7 @@ "@remix-run/cloudflare-pages": "*", "@remix-run/css-bundle": "*", "@remix-run/react": "*", - "isbot": "^3.6.8", + "isbot": "^4.1.0", "react": "^18.2.0", "react-dom": "^18.2.0" }, diff --git a/templates/cloudflare-workers/app/entry.server.tsx b/templates/cloudflare-workers/app/entry.server.tsx index 3f5b9989333..0d5c40a755e 100644 --- a/templates/cloudflare-workers/app/entry.server.tsx +++ b/templates/cloudflare-workers/app/entry.server.tsx @@ -6,7 +6,7 @@ import type { AppLoadContext, EntryContext } from "@remix-run/cloudflare"; import { RemixServer } from "@remix-run/react"; -import isbot from "isbot"; +import { isbot } from "isbot"; import { renderToReadableStream } from "react-dom/server"; export default async function handleRequest( @@ -31,7 +31,7 @@ export default async function handleRequest( } ); - if (isbot(request.headers.get("user-agent"))) { + if (isbot(request.headers.get("user-agent") || "")) { await body.allReady; } diff --git a/templates/cloudflare-workers/package.json b/templates/cloudflare-workers/package.json index abab2ac1a74..580f5e83fbc 100644 --- a/templates/cloudflare-workers/package.json +++ b/templates/cloudflare-workers/package.json @@ -15,7 +15,7 @@ "@remix-run/cloudflare": "*", "@remix-run/css-bundle": "*", "@remix-run/react": "*", - "isbot": "^3.6.8", + "isbot": "^4.1.0", "react": "^18.2.0", "react-dom": "^18.2.0" }, diff --git a/templates/deno/.vscode/resolve_npm_imports.json b/templates/deno/.vscode/resolve_npm_imports.json index ca2ae22b5d0..af7431c1ee9 100644 --- a/templates/deno/.vscode/resolve_npm_imports.json +++ b/templates/deno/.vscode/resolve_npm_imports.json @@ -13,7 +13,7 @@ "@remix-run/dev/server-build": "https://esm.sh/@remix-run/dev@1.16.0/server-build", "@remix-run/react": "https://esm.sh/@remix-run/react@1.16.0", "@remix-run/server-runtime": "https://esm.sh/@remix-run/server-runtime@1.16.0", - "isbot": "https://esm.sh/isbot@^3.6.8", + "isbot": "https://esm.sh/isbot@^4.1.0", "react": "https://esm.sh/react@^18.2.0", "react-dom": "https://esm.sh/react-dom@^18.2.0", "react-dom/client": "https://esm.sh/react-dom@^18.2.0/client", diff --git a/templates/deno/app/entry.server.tsx b/templates/deno/app/entry.server.tsx index 83ce4317722..25ea9f5f941 100644 --- a/templates/deno/app/entry.server.tsx +++ b/templates/deno/app/entry.server.tsx @@ -6,7 +6,7 @@ import type { AppLoadContext, EntryContext } from "@remix-run/deno"; import { RemixServer } from "@remix-run/react"; -import isbot from "isbot"; +import { isbot } from "isbot"; import { renderToReadableStream } from "react-dom/server"; export default async function handleRequest( @@ -17,7 +17,7 @@ export default async function handleRequest( // This is ignored so we can keep it in the template for visibility. Feel // free to delete this parameter in your app if you're not using it! // eslint-disable-next-line @typescript-eslint/no-unused-vars - loadContext: AppLoadContext, + loadContext: AppLoadContext ) { const body = await renderToReadableStream( , @@ -28,10 +28,10 @@ export default async function handleRequest( console.error(error); responseStatusCode = 500; }, - }, + } ); - if (isbot(request.headers.get("user-agent"))) { + if (isbot(request.headers.get("user-agent") || "")) { await body.allReady; } diff --git a/templates/deno/package.json b/templates/deno/package.json index 476a4bc088f..86785541fef 100644 --- a/templates/deno/package.json +++ b/templates/deno/package.json @@ -16,7 +16,7 @@ "@remix-run/css-bundle": "*", "@remix-run/deno": "*", "@remix-run/react": "*", - "isbot": "^3.6.8", + "isbot": "^4.1.0", "react": "^18.2.0", "react-dom": "^18.2.0" }, diff --git a/templates/express/app/entry.server.tsx b/templates/express/app/entry.server.tsx index e2002b0740e..45db3229c68 100644 --- a/templates/express/app/entry.server.tsx +++ b/templates/express/app/entry.server.tsx @@ -9,7 +9,7 @@ import { PassThrough } from "node:stream"; import type { AppLoadContext, EntryContext } from "@remix-run/node"; import { createReadableStreamFromReadable } from "@remix-run/node"; import { RemixServer } from "@remix-run/react"; -import isbot from "isbot"; +import { isbot } from "isbot"; import { renderToPipeableStream } from "react-dom/server"; const ABORT_DELAY = 5_000; @@ -24,7 +24,7 @@ export default function handleRequest( // eslint-disable-next-line @typescript-eslint/no-unused-vars loadContext: AppLoadContext ) { - return isbot(request.headers.get("user-agent")) + return isbot(request.headers.get("user-agent") || "") ? handleBotRequest( request, responseStatusCode, diff --git a/templates/express/package.json b/templates/express/package.json index 5cb109be617..eb78ee847ff 100644 --- a/templates/express/package.json +++ b/templates/express/package.json @@ -17,7 +17,7 @@ "compression": "^1.7.4", "cross-env": "^7.0.3", "express": "^4.18.2", - "isbot": "^3.6.8", + "isbot": "^4.1.0", "morgan": "^1.10.0", "react": "^18.2.0", "react-dom": "^18.2.0", diff --git a/templates/fly/app/entry.server.tsx b/templates/fly/app/entry.server.tsx index e2002b0740e..45db3229c68 100644 --- a/templates/fly/app/entry.server.tsx +++ b/templates/fly/app/entry.server.tsx @@ -9,7 +9,7 @@ import { PassThrough } from "node:stream"; import type { AppLoadContext, EntryContext } from "@remix-run/node"; import { createReadableStreamFromReadable } from "@remix-run/node"; import { RemixServer } from "@remix-run/react"; -import isbot from "isbot"; +import { isbot } from "isbot"; import { renderToPipeableStream } from "react-dom/server"; const ABORT_DELAY = 5_000; @@ -24,7 +24,7 @@ export default function handleRequest( // eslint-disable-next-line @typescript-eslint/no-unused-vars loadContext: AppLoadContext ) { - return isbot(request.headers.get("user-agent")) + return isbot(request.headers.get("user-agent") || "") ? handleBotRequest( request, responseStatusCode, diff --git a/templates/fly/package.json b/templates/fly/package.json index a4672d381f1..124c3539f95 100644 --- a/templates/fly/package.json +++ b/templates/fly/package.json @@ -15,7 +15,7 @@ "@remix-run/node": "*", "@remix-run/react": "*", "@remix-run/serve": "*", - "isbot": "^3.6.8", + "isbot": "^4.1.0", "react": "^18.2.0", "react-dom": "^18.2.0" }, diff --git a/templates/remix-javascript/app/entry.server.jsx b/templates/remix-javascript/app/entry.server.jsx index fcbefdcd804..386849510c9 100644 --- a/templates/remix-javascript/app/entry.server.jsx +++ b/templates/remix-javascript/app/entry.server.jsx @@ -8,7 +8,7 @@ import { PassThrough } from "node:stream"; import { createReadableStreamFromReadable } from "@remix-run/node"; import { RemixServer } from "@remix-run/react"; -import isbot from "isbot"; +import { isbot } from "isbot"; import { renderToPipeableStream } from "react-dom/server"; const ABORT_DELAY = 5_000; @@ -19,7 +19,7 @@ export default function handleRequest( responseHeaders, remixContext ) { - return isbot(request.headers.get("user-agent")) + return isbot(request.headers.get("user-agent") || "") ? handleBotRequest( request, responseStatusCode, diff --git a/templates/remix-javascript/package.json b/templates/remix-javascript/package.json index e821a97d2b5..637d2757d85 100644 --- a/templates/remix-javascript/package.json +++ b/templates/remix-javascript/package.json @@ -13,7 +13,7 @@ "@remix-run/node": "*", "@remix-run/react": "*", "@remix-run/serve": "*", - "isbot": "^3.6.8", + "isbot": "^4.1.0", "react": "^18.2.0", "react-dom": "^18.2.0" }, diff --git a/templates/remix-tutorial/package.json b/templates/remix-tutorial/package.json index 52bfc990bb6..a842857dcb1 100644 --- a/templates/remix-tutorial/package.json +++ b/templates/remix-tutorial/package.json @@ -12,7 +12,7 @@ "@remix-run/node": "*", "@remix-run/react": "*", "@remix-run/serve": "*", - "isbot": "^3.6.13", + "isbot": "^4.1.0", "match-sorter": "^6.3.1", "react": "^18.2.0", "react-dom": "^18.2.0", diff --git a/templates/remix/app/entry.server.tsx b/templates/remix/app/entry.server.tsx index e2002b0740e..45db3229c68 100644 --- a/templates/remix/app/entry.server.tsx +++ b/templates/remix/app/entry.server.tsx @@ -9,7 +9,7 @@ import { PassThrough } from "node:stream"; import type { AppLoadContext, EntryContext } from "@remix-run/node"; import { createReadableStreamFromReadable } from "@remix-run/node"; import { RemixServer } from "@remix-run/react"; -import isbot from "isbot"; +import { isbot } from "isbot"; import { renderToPipeableStream } from "react-dom/server"; const ABORT_DELAY = 5_000; @@ -24,7 +24,7 @@ export default function handleRequest( // eslint-disable-next-line @typescript-eslint/no-unused-vars loadContext: AppLoadContext ) { - return isbot(request.headers.get("user-agent")) + return isbot(request.headers.get("user-agent") || "") ? handleBotRequest( request, responseStatusCode, diff --git a/templates/remix/package.json b/templates/remix/package.json index 9a7d370bf82..8b270dd9c7b 100644 --- a/templates/remix/package.json +++ b/templates/remix/package.json @@ -14,7 +14,7 @@ "@remix-run/node": "*", "@remix-run/react": "*", "@remix-run/serve": "*", - "isbot": "^3.6.8", + "isbot": "^4.1.0", "react": "^18.2.0", "react-dom": "^18.2.0" }, diff --git a/templates/unstable-vite-express/package.json b/templates/unstable-vite-express/package.json index eaf95912f85..5548ecbe3f9 100644 --- a/templates/unstable-vite-express/package.json +++ b/templates/unstable-vite-express/package.json @@ -14,7 +14,7 @@ "@remix-run/node": "*", "@remix-run/react": "*", "express": "^4.18.2", - "isbot": "^3.6.8", + "isbot": "^4.1.0", "react": "^18.2.0", "react-dom": "^18.2.0" }, diff --git a/templates/unstable-vite/package.json b/templates/unstable-vite/package.json index 2e900a79357..3e83fca53ce 100644 --- a/templates/unstable-vite/package.json +++ b/templates/unstable-vite/package.json @@ -13,7 +13,7 @@ "@remix-run/node": "*", "@remix-run/react": "*", "@remix-run/serve": "*", - "isbot": "^3.6.8", + "isbot": "^4.1.0", "react": "^18.2.0", "react-dom": "^18.2.0" }, diff --git a/yarn.lock b/yarn.lock index 7d4e530741b..7b9396a7ae1 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7555,10 +7555,10 @@ isarray@~1.0.0: resolved "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz" integrity sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE= -isbot@^3.6.8: - version "3.6.13" - resolved "https://registry.npmjs.org/isbot/-/isbot-3.6.13.tgz#e060f727cb53475a4dab1569321ced0f84633d63" - integrity sha512-uoP4uK5Dc2CrabmK+Gue1jTL+scHiCc1c9rblRpJwG8CPxjLIv8jmGyyGRGkbPOweayhkskdZsEQXG6p+QCQrg== +isbot@^4.1.0: + version "4.1.0" + resolved "https://registry.npmjs.org/isbot/-/isbot-4.1.0.tgz#e05b0d6534bb61a87bc34ab8cdba0a53f75c6752" + integrity sha512-Kz7zk1wc0oC0FYLYtqea1RKdEX4XGlqacPhoaq9HSEQamEXQNJ/MzVzBKAQXDCCHO0h/eo4CdZs9t3Jfbup5Aw== isexe@^2.0.0: version "2.0.0"