feat(admin): 为支持单删的管理列表补齐批量删除
This commit is contained in:
@@ -15,8 +15,12 @@ const INDEX_CANDIDATES = ['/index.ts', '/index.tsx', '/index.vue', '/index.js']
|
||||
* (内容逐字节等价,主树 LF 3565 B / 新检出 CRLF 3629 B)在干净检出树上会多红一条与本任务无关的用例。
|
||||
* 归一之后判据只取决于内容,不取决于在哪台机器、哪个 worktree 里跑。
|
||||
*/
|
||||
export function readSource(rel: string): string {
|
||||
return readFileSync(join(ROOT, rel), 'utf8').replace(/\r\n/g, '\n')
|
||||
export function readSource(rel: string, includeVueStyles = false): string {
|
||||
const source = readFileSync(join(ROOT, rel), 'utf8').replace(/\r\n/g, '\n')
|
||||
if (!includeVueStyles) return source
|
||||
const styles = [...source.matchAll(/<style\b[^>]*\bsrc="(\.\/[^"\n]+\.css)"[^>]*>/g)]
|
||||
.map(([, path]) => readSource(join(dirname(rel), path)))
|
||||
return [source, ...styles].join('\n')
|
||||
}
|
||||
|
||||
/** 统计非重叠子串出现次数(幂等、只读)。 */
|
||||
|
||||
Reference in New Issue
Block a user