import "@johnlindquist/kit";
const text = await getSelectedText();
function convertImportString(input) {
const importRegex = /import\s+({[^}]+})\s+from\s+"([^"]+)";/;
if (!importRegex.test(input)) {
throw new Error("Invalid import string format");
}
const [_, importList, modulePath] = input.match(importRegex);
const output = `let ${importList} = await import("${modulePath}");`;
return output;
}
const output = convertImportString(text);
await setSelectedText(output);