@limlabs/limo
Version:
Infrastructure as Code generator
14 lines (13 loc) • 498 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.extractImports = void 0;
const extractImports = (code) => {
const importRegex = /import\s+(?:\*\s+as\s+.+?|{(.+?)}|.+?)\s+from\s+['"](.+?)['"]/g;
const imports = new Set();
let match;
while ((match = importRegex.exec(code))) {
imports.add(match[2]);
}
return Array.from(imports).filter((i) => !i.startsWith(".") && !i.startsWith("@/"));
};
exports.extractImports = extractImports;