Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export async function resolveModuleImports(rootDir, sourceFilePath, source, config) {
let imports;
try {
[imports] = await parse(source, sourceFilePath);
} catch (error) {
await createSyntaxError(sourceFilePath, source, error);
}
let resolvedSource = '';
let lastIndex = 0;
for (const imp of imports) {
const { s: start, e: end, d: dynamicImportIndex } = imp;
if (dynamicImportIndex === -1) {
// static import
const [importPath, importPathSuffix] = getImportPath(source.substring(start, end));
const resolvedImportPath = await resolveImport(rootDir, sourceFilePath, importPath, config);
resolvedSource += `${source.substring(