import type * as d from '../../../declarations' ; import { addExternalImport } from '../collections/add-external-import' ; import { isAbsolute , resolve } from 'path' ; import { normalizePath } from '@utils' ; import ts from 'typescript' ; export const parseModuleImport = ( config , compilerCtx , buildCtx , moduleFile , dirPath , importNode , resolveCollections ) => { if ( importNode . moduleSpecifier && ts . isStringLiteral ( importNode . moduleSpecifier ) ) { let importPath = importNode . moduleSpecifier . text ; if ( ! moduleFile . originalImports . includes ( importPath ) ) { moduleFile . originalImports . push ( importPath ) ; } if ( isAbsolute ( importPath ) ) { importPath = normalizePath ( importPath ) ; moduleFile . localImports . push ( importPath ) ; } else if ( importPath . startsWith ( '.' ) ) { importPath = normalizePath ( resolve ( dirPath , importPath ) ) ; moduleFile . localImports . push ( importPath ) ; } else { addExternalImport ( config , compilerCtx , buildCtx , moduleFile , moduleFile . sourceFilePath , importPath , resolveCollections ) ; } } } ;