Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(deps): update dependency isbot to v5 #10340

Merged
merged 3 commits into from May 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/vite/package.json
Expand Up @@ -81,7 +81,7 @@
"express": "4.19.2",
"find-my-way": "8.2.0",
"http-proxy-middleware": "2.0.6",
"isbot": "3.8.0",
"isbot": "5.1.6",
"react": "19.0.0-beta-04b058868c-20240508",
"react-server-dom-webpack": "19.0.0-beta-04b058868c-20240508",
"vite": "5.2.11",
Expand Down
12 changes: 6 additions & 6 deletions packages/vite/src/streaming/createReactStreamingHandler.ts
Expand Up @@ -3,7 +3,7 @@ import path from 'path'
import { Response } from '@whatwg-node/fetch'
import type Router from 'find-my-way'
import type { HTTPMethod } from 'find-my-way'
import isbot from 'isbot'
import { createIsbotFromList, list as isbotList } from 'isbot'
import type { ViteDevServer } from 'vite'

import { middlewareDefaultAuthProviderState } from '@redwoodjs/auth'
Expand All @@ -28,8 +28,10 @@ interface CreateReactStreamingHandlerOptions {
getMiddlewareRouter: () => Promise<Router.Instance<any>>
}

const checkUaForSeoCrawler = isbot.spawn()
checkUaForSeoCrawler.exclude(['chrome-lighthouse'])
// Create an isbot instance that ignores the Chrome Lighthouse user agent
const isbot = createIsbotFromList(
isbotList.filter((record) => !record.includes('chrome-lighthouse')),
)

export const createReactStreamingHandler = async (
{
Expand Down Expand Up @@ -167,9 +169,7 @@ export const createReactStreamingHandler = async (
currentRoute.bundle && '/' + currentRoute.bundle,
].filter(Boolean) as string[]

const isSeoCrawler = checkUaForSeoCrawler(
req.headers.get('user-agent') || '',
)
const isSeoCrawler = isbot(req.headers.get('user-agent') || '')

// Using a function to get the CSS links because we need to wait for the
// vite dev server to analyze the module graph
Expand Down
10 changes: 5 additions & 5 deletions yarn.lock
Expand Up @@ -8695,7 +8695,7 @@ __metadata:
find-my-way: "npm:8.2.0"
glob: "npm:10.3.15"
http-proxy-middleware: "npm:2.0.6"
isbot: "npm:3.8.0"
isbot: "npm:5.1.6"
react: "npm:19.0.0-beta-04b058868c-20240508"
react-server-dom-webpack: "npm:19.0.0-beta-04b058868c-20240508"
rollup: "npm:4.17.2"
Expand Down Expand Up @@ -20644,10 +20644,10 @@ __metadata:
languageName: node
linkType: hard

"isbot@npm:3.8.0":
version: 3.8.0
resolution: "isbot@npm:3.8.0"
checksum: 10c0/3e9daa907212db8e8e339fe0c7eacff7814de0db0aeef9ab379376b245f35058c6bdd2de0849442a791bc3d9587d749071e7d7e90aea00bf9f834f40c69ea16f
"isbot@npm:5.1.6":
version: 5.1.6
resolution: "isbot@npm:5.1.6"
checksum: 10c0/c0883a4f91882abed46be2bedb0e36acf8db74ec9866d752991ebb2982c84faa04a774bd20d36b988701611e2fdf518a977edd640a9b28e668a91d3e2c48a3d7
languageName: node
linkType: hard

Expand Down