diff --git a/packages-node/providence-analytics/src/program/analyzers/helpers/from-import-to-export-perspective.js b/packages-node/providence-analytics/src/program/analyzers/helpers/from-import-to-export-perspective.js index 0cea11874..deb0a6947 100644 --- a/packages-node/providence-analytics/src/program/analyzers/helpers/from-import-to-export-perspective.js +++ b/packages-node/providence-analytics/src/program/analyzers/helpers/from-import-to-export-perspective.js @@ -1,3 +1,4 @@ +import path from 'path'; import { isRelativeSourcePath } from '../../utils/relative-source-path.js'; import { LogService } from '../../core/LogService.js'; import { resolveImportPath } from '../../utils/resolve-import-path.js'; @@ -35,7 +36,10 @@ export async function fromImportToExportPerspective({ importee, importer, import return null; } - const absolutePath = await resolveImportPath(importee, importer); + const absolutePath = await resolveImportPath(importee, importer, { + modulePaths: [path.resolve(importeeProjectPath, '..')], + }); + if (!absolutePath) { return null; } diff --git a/packages-node/providence-analytics/src/program/utils/resolve-import-path.js b/packages-node/providence-analytics/src/program/utils/resolve-import-path.js index ab092c20a..b20c4d514 100644 --- a/packages-node/providence-analytics/src/program/utils/resolve-import-path.js +++ b/packages-node/providence-analytics/src/program/utils/resolve-import-path.js @@ -36,10 +36,10 @@ const fakePluginContext = { * name without an extension. * @param {SpecifierSource} importee source like '@lion/core' or '../helpers/index.js' * @param {PathFromSystemRoot} importer importing file, like '/my/project/importing-file.js' - * @param {{customResolveOptions?: {preserveSymlinks:boolean}}} [opts] nodeResolve options + * @param {{customResolveOptions?: {preserveSymlinks:boolean}; modulePaths?: string[]}} [opts] nodeResolve options * @returns {Promise} the resolved file system path, like '/my/project/node_modules/@lion/core/index.js' */ -async function resolveImportPathFn(importee, importer, opts) { +async function resolveImportPathFn(importee, importer, opts = {}) { if (isBuiltin(importee)) { return '[node-builtin]'; } @@ -49,7 +49,7 @@ async function resolveImportPathFn(importee, importer, opts) { // allow resolving polyfills for nodejs libs preferBuiltins: false, // extensions: ['.mjs', '.js', '.json', '.node'], - ...(opts || {}), + ...opts, }); const preserveSymlinks =