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

Function fileToUrl

packages/vite/src/node/plugins/asset.ts:320–331  ·  view source on GitHub ↗
(
  pluginContext: PluginContext,
  id: string,
  asFileUrl = false,
)

Source from the content-addressed store, hash-verified

318}
319
320export async function fileToUrl(
321 pluginContext: PluginContext,
322 id: string,
323 asFileUrl = false,
324): Promise<string> {
325 const { environment } = pluginContext
326 if (!environment.config.isBundled) {
327 return fileToDevUrl(environment, id, asFileUrl)
328 } else {
329 return fileToBuiltUrl(pluginContext, id)
330 }
331}
332
333export async function fileToDevUrl(
334 environment: Environment,

Callers 6

handlerFunction · 0.90
handlerFunction · 0.90
urlResolverFunction · 0.90
handlerFunction · 0.90
handlerFunction · 0.90
handlerFunction · 0.70

Calls 2

fileToDevUrlFunction · 0.85
fileToBuiltUrlFunction · 0.85

Tested by

no test coverage detected