MCPcopy
hub / github.com/vitest-dev/vitest / toBuiltin

Function toBuiltin

packages/vitest/src/utils/modules.ts:41–56  ·  view source on GitHub ↗
(id: string)

Source from the content-addressed store, hash-verified

39}
40
41export function toBuiltin(id: string): string {
42 if (id.startsWith(browserExternalId)) {
43 id = id.slice(browserExternalLength)
44 }
45 if (
46 id.startsWith(NPM_BUILTIN_NAMESPACE)
47 || id.startsWith(BUN_BUILTIN_NAMESPACE)
48 || id.startsWith(NODE_BUILTIN_NAMESPACE)
49 ) {
50 return id
51 }
52 if (isDeno || isBun) {
53 return id
54 }
55 return `node:${id}`
56}

Callers 5

fetchModuleFunction · 0.90
loadAutomockMethod · 0.90
loadManualMockMethod · 0.90
resolveFunction · 0.90
resolveFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected