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

Function resolveId

packages/vite/src/node/optimizer/pluginConverter.ts:157–174  ·  view source on GitHub ↗
(id, importer, opts)

Source from the content-addressed store, hash-verified

155 }
156 },
157 async resolveId(id, importer, opts) {
158 for (const handler of resolveIdHandlers) {
159 const result = await handler.call(this, id, importer, opts)
160 if (result) {
161 if (typeof result === 'object' && result.namespace) {
162 usedNamespaces.add(result.namespace)
163 }
164 return result
165 }
166 }
167 if (usedNamespaces.size) {
168 const [importerWithoutNamespace, namespaceFromImporter] =
169 idToPathAndNamespace(importer)
170 if (usedNamespaces.has(namespaceFromImporter)) {
171 return await this.resolve(id, importerWithoutNamespace, opts)
172 }
173 }
174 },
175 async load(id) {
176 for (const handler of loadHandlers) {
177 const result = await handler.call(this, id)

Callers

nothing calls this directly

Calls 4

idToPathAndNamespaceFunction · 0.85
addMethod · 0.80
hasMethod · 0.80
resolveMethod · 0.65

Tested by

no test coverage detected