MCPcopy Index your code
hub / github.com/nodejs/node / #cachedDefaultResolve

Method #cachedDefaultResolve

lib/internal/modules/esm/loader.js:696–707  ·  view source on GitHub ↗

* Either return a cached resolution, or perform the default resolution which is synchronous, and * cache the result. * @param {string} specifier See resolve. * @param {{ parentURL?: string, importAttributes: ImportAttributes, conditions?: string[]}} context * @returns {{ format:

(specifier, context)

Source from the content-addressed store, hash-verified

694 * @returns {{ format: string, url: string }}
695 */
696 #cachedDefaultResolve(specifier, context) {
697 const { parentURL, importAttributes } = context;
698 const requestKey = this.#resolveCache.serializeKey(specifier, importAttributes);
699 const cachedResult = this.#resolveCache.get(requestKey, parentURL);
700 if (cachedResult != null) {
701 return cachedResult;
702 }
703
704 const result = defaultResolve(specifier, context);
705 this.#resolveCache.set(requestKey, parentURL, result);
706 return result;
707 }
708
709 /**
710 * This is the default resolve step for module.registerHooks(), which incorporates asynchronous hooks

Calls 4

serializeKeyMethod · 0.80
defaultResolveFunction · 0.70
getMethod · 0.65
setMethod · 0.45

Tested by

no test coverage detected