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

Function idToPathAndNamespace

packages/vite/src/node/optimizer/pluginConverter.ts:307–318  ·  view source on GitHub ↗
(
  id: string | undefined,
)

Source from the content-addressed store, hash-verified

305 id: string | undefined,
306): [path: string | undefined, namespace: string]
307function idToPathAndNamespace(
308 id: string | undefined,
309): [path: string | undefined, namespace: string] {
310 if (id === undefined) return [undefined, 'file']
311
312 const namespaceIndex = id.indexOf(':')
313 if (namespaceIndex >= 0) {
314 return [id.slice(namespaceIndex + 1), id.slice(0, namespaceIndex)]
315 } else {
316 return [id, 'file']
317 }
318}

Callers 3

resolveIdFunction · 0.85
createResolveIdHandlerFunction · 0.85
createLoadHandlerFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected