MCPcopy Index your code
hub / github.com/rollup/plugins / handler

Function handler

packages/node-resolve/src/index.js:298–342  ·  view source on GitHub ↗
(importee, importer, resolveOptions)

Source from the content-addressed store, hash-verified

296 resolveId: {
297 order: 'post',
298 async handler(importee, importer, resolveOptions) {
299 if (importee === ES6_BROWSER_EMPTY) {
300 return importee;
301 }
302 // ignore IDs with null character, these belong to other plugins
303 if (importee && importee.includes('\0')) return null;
304
305 const { custom = {} } = resolveOptions;
306 const { 'node-resolve': { resolved: alreadyResolved } = {} } = custom;
307 if (alreadyResolved) {
308 return alreadyResolved;
309 }
310
311 if (importer && importer.includes('\0')) {
312 importer = undefined;
313 }
314
315 const resolved = await resolveLikeNode(this, importee, importer, custom);
316 if (resolved) {
317 // This way, plugins may attach additional meta information to the
318 // resolved id or make it external. We do not skip node-resolve here
319 // because another plugin might again use `this.resolve` in its
320 // `resolveId` hook, in which case we want to add the correct
321 // `moduleSideEffects` information.
322 const resolvedResolved = await this.resolve(resolved.id, importer, {
323 ...resolveOptions,
324 skipSelf: false,
325 custom: { ...custom, 'node-resolve': { ...custom['node-resolve'], resolved, importee } }
326 });
327 if (resolvedResolved) {
328 // Handle plugins that manually make the result external
329 if (resolvedResolved.external) {
330 return false;
331 }
332 // Allow other plugins to take over resolution. Rollup core will not
333 // change the id if it corresponds to an existing file
334 if (resolvedResolved.id !== resolved.id) {
335 return resolvedResolved;
336 }
337 // Pass on meta information added by other plugins
338 return { ...resolved, meta: resolvedResolved.meta };
339 }
340 }
341 return resolved;
342 }
343 },
344
345 load(importee) {

Callers

nothing calls this directly

Calls 1

resolveLikeNodeFunction · 0.85

Tested by

no test coverage detected