MCPcopy
hub / github.com/react/react / resolve

Function resolve

packages/react-server-dom-esm/src/ReactFlightESMNodeLoader.js:66–89  ·  view source on GitHub ↗
(
  specifier: string,
  context: ResolveContext,
  defaultResolve: ResolveFunction,
)

Source from the content-addressed store, hash-verified

64let stashedResolve: null | ResolveFunction = null;
65
66export async function resolve(
67 specifier: string,
68 context: ResolveContext,
69 defaultResolve: ResolveFunction,
70): Promise<{url: string}> {
71 // We stash this in case we end up needing to resolve export * statements later.
72 stashedResolve = defaultResolve;
73
74 if (!context.conditions.includes('react-server')) {
75 context = {
76 ...context,
77 conditions: [...context.conditions, 'react-server'],
78 };
79 if (!warnedAboutConditionsFlag) {
80 warnedAboutConditionsFlag = true;
81 // eslint-disable-next-line react-internal/no-production-logging
82 console.warn(
83 'You did not run Node.js with the `--conditions react-server` flag. ' +
84 'Any "react-server" override will only work with ESM imports.',
85 );
86 }
87 }
88 return await defaultResolve(specifier, context, defaultResolve);
89}
90
91export async function getSource(
92 url: string,

Callers 15

flushTasksFunction · 0.50
thenFunction · 0.50
retryFunction · 0.50
progressFunction · 0.50
retryFunction · 0.50
resolveToJSONFunction · 0.50
abortFunction · 0.50
processReplyFunction · 0.50
encodeFormDataFunction · 0.50
waitForMicrotasksFunction · 0.50

Calls

no outgoing calls

Tested by 7

flushTasksFunction · 0.40
thenFunction · 0.40
readResultFunction · 0.40
finishLoadingStreamFunction · 0.40
getDataFunction · 0.40
ComponentFunction · 0.40
thirdPartyFunction · 0.40