const fs = require("fs"); const path = require("path"); const SRC = path.join(__dirname, "../src"); const SKIP = /copy\.vue$|weatherInfo copy/i; const CHINESE_RE = /[\u4e00-\u9fff][\u4e00-\u9fff\d,。、?!:;""''()【】\-\s%%·]*/g; function walk(dir, files = []) { for (const name of fs.readdirSync(dir)) { const p = path.join(dir, name); const stat = fs.statSync(p); if (stat.isDirectory()) { if (name !== "node_modules") walk(p, files); } else if (/\.(vue|js)$/.test(name) && !SKIP.test(p)) { files.push(p); } } return files; } const set = new Set(); for (const file of walk(SRC)) { const content = fs.readFileSync(file, "utf8"); const matches = content.match(CHINESE_RE) || []; matches.forEach((m) => { const s = m.trim(); if (s.length >= 2 && /[\u4e00-\u9fff]/.test(s)) set.add(s); }); } const list = [...set].sort((a, b) => b.length - a.length); console.log(JSON.stringify(list, null, 2));