const { tranvase } = require("./lib/utils");
const fs = require("fs");

const config = {
    handler: filePath => {
        if (filePath.includes("test") || filePath.includes("dist")) {
            return;
        }
        let content = fs.readFileSync(filePath).toString();
        let reg = /(['"`])(.*?)\1/g;
        if (reg.test(content)) {
            Array.from(content.matchAll(reg))
                .map(el => el[2])
                .forEach(el => {
                    if (Array.from(el).some(el => el.charCodeAt(0) > 255)) {
                        console.log(filePath, el);
                    }
                });
        }
    },
};

tranvase(process.argv[2], config);