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

Function getModuleTypeFromId

packages/vite/src/node/server/transformRequest.ts:556–565  ·  view source on GitHub ↗
(id: string)

Source from the content-addressed store, hash-verified

554
555// https://github.com/rolldown/rolldown/blob/bf53a100edf1780d5a5aa41f0bc0459c5696543e/crates/rolldown/src/utils/load_source.rs#L53-L89
556export function getModuleTypeFromId(id: string): ModuleType | undefined {
557 let pos = -1
558 while ((pos = id.indexOf('.', pos + 1)) >= 0) {
559 const ext = id.slice(pos + 1)
560 const moduleType = defaultModuleTypes[ext]
561 if (moduleType) {
562 return moduleType
563 }
564 }
565}

Callers 2

loadAndTransformFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected