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

Function urlToBuiltUrl

packages/vite/src/node/plugins/asset.ts:512–534  ·  view source on GitHub ↗
(
  pluginContext: PluginContext,
  url: string,
  importer: string,
  forceInline?: boolean,
)

Source from the content-addressed store, hash-verified

510}
511
512export async function urlToBuiltUrl(
513 pluginContext: PluginContext,
514 url: string,
515 importer: string,
516 forceInline?: boolean,
517): Promise<string> {
518 const topLevelConfig = pluginContext.environment.getTopLevelConfig()
519 if (checkPublicFile(url, topLevelConfig)) {
520 return publicFileToBuiltUrl(url, topLevelConfig)
521 }
522 const file = normalizePath(
523 url[0] === '/'
524 ? path.join(topLevelConfig.root, url)
525 : path.join(path.dirname(importer), url),
526 )
527 return fileToBuiltUrl(
528 pluginContext,
529 file,
530 // skip public check since we just did it above
531 true,
532 forceInline,
533 )
534}
535
536function shouldInline(
537 environment: Environment,

Callers 2

processAssetUrlFunction · 0.90
handlerFunction · 0.90

Calls 5

checkPublicFileFunction · 0.90
normalizePathFunction · 0.90
publicFileToBuiltUrlFunction · 0.85
fileToBuiltUrlFunction · 0.85
getTopLevelConfigMethod · 0.80

Tested by

no test coverage detected