3f8f72bf9b
Follow up for https://github.com/vercel/next.js/pull/40415 Remove internal next client api determination, fully relying on `'client'` directive. Change `.client.js` extension to `.js ` in tests, remove legacy / unused test files
12 lines
430 B
TypeScript
12 lines
430 B
TypeScript
import { RSC_MODULE_TYPES } from '../../../shared/lib/constants'
|
|
|
|
const imageExtensions = ['jpg', 'jpeg', 'png', 'webp', 'avif']
|
|
const imageRegex = new RegExp(`\\.(${imageExtensions.join('|')})$`)
|
|
|
|
export function isClientComponentModule(mod: {
|
|
resource: string
|
|
buildInfo: any
|
|
}) {
|
|
const hasClientDirective = mod.buildInfo.rsc?.type === RSC_MODULE_TYPES.client
|
|
return hasClientDirective || imageRegex.test(mod.resource)
|
|
}
|