MCPcopy
hub / github.com/vitejs/vite / isJSRequest

Function isJSRequest

packages/vite/src/node/utils.ts:294–303  ·  view source on GitHub ↗
(url: string)

Source from the content-addressed store, hash-verified

292const knownJsSrcRE =
293 /\.(?:[jt]sx?|m[jt]s|vue|marko|svelte|astro|imba|mdx)(?:$|\?)/
294export const isJSRequest = (url: string): boolean => {
295 url = cleanUrl(url)
296 if (knownJsSrcRE.test(url)) {
297 return true
298 }
299 if (!path.extname(url) && url[url.length - 1] !== '/') {
300 return true
301 }
302 return false
303}
304
305export const isCSSRequest = (request: string): boolean =>
306 CSS_LANGS_RE.test(request)

Callers 4

shouldPreTransformFunction · 0.90
transformMiddlewareFunction · 0.90
isExplicitImportRequiredFunction · 0.90
createParseErrorInfoFunction · 0.90

Calls 1

cleanUrlFunction · 0.90

Tested by

no test coverage detected