MCPcopy
hub / github.com/tailwindlabs/tailwindcss / resolveJsId

Function resolveJsId

packages/@tailwindcss-node/src/compile.ts:248–268  ·  view source on GitHub ↗
(
  id: string,
  base: string,
  customJsResolver?: Resolver,
)

Source from the content-addressed store, hash-verified

246})
247
248async function resolveJsId(
249 id: string,
250 base: string,
251 customJsResolver?: Resolver,
252): Promise<string | false | undefined> {
253 if (typeof globalThis.__tw_resolve === 'function') {
254 let resolved = globalThis.__tw_resolve(id, base)
255 if (resolved) {
256 return Promise.resolve(resolved)
257 }
258 }
259
260 if (customJsResolver) {
261 let customResolution = await customJsResolver(id, base)
262 if (customResolution) {
263 return customResolution
264 }
265 }
266
267 return runResolver(esmResolver, id, base).catch(() => runResolver(cjsResolver, id, base))
268}
269
270function runResolver(
271 resolver: EnhancedResolve.Resolver,

Callers 1

loadModuleFunction · 0.70

Calls 2

runResolverFunction · 0.85
resolveMethod · 0.80

Tested by

no test coverage detected