nomadro/apps/miniprogram/weapp/scripts/_run-sanitize-once.cjs
Eric 4389ebe6cb Ship WeChat audit release 2026-11-02: realtime config, audit vip-ebook shell, admin ops.
Document test9 tag 2026-11-02 for upload; POST config pull + WS, fixed dark home, no debug bar.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-11-02 16:12:57 +08:00

37 lines
1.3 KiB
JavaScript

const fs = require('fs')
const path = require('path')
const { sanitizeDir, sanitizeWxssSource, rewriteSelectorList } = require('./sanitize-wxss-plugin.cjs')
const samples = [
'.connection-copy h1',
'.social-home .nav-links:not(.open)',
'.social-cafe-grid .social-card > :not(.social-cafe-art)',
'.social-meetup-faces > *:first-child',
'.social-home :is(a, button):focus-visible',
]
for (const s of samples) {
console.log(s, '=>', rewriteSelectorList(s) || '(dropped)')
}
const dist = path.resolve(__dirname, '../dist')
const t0 = Date.now()
const r = sanitizeDir(dist)
console.log('sanitizeDir', r, 'ms', Date.now() - t0)
const vendors = path.join(dist, 'pages/social/sub-vendors.wxss')
if (fs.existsSync(vendors)) {
const s = fs.readFileSync(vendors, 'utf8')
console.log({
bytes: s.length,
asH1: (s.match(/\.as-h1/g) || []).length,
asA: (s.match(/\.as-a/g) || []).length,
asButton: (s.match(/\.as-button/g) || []).length,
connectionCopy: (s.match(/\.connection-copy\s+\.as-h1/g) || []).length,
rawTagH1: (s.match(/(^|[^\w-])h1(\s|,|\{|>)/gm) || []).length,
notLeft: (s.match(/:not\(/g) || []).length,
hasLeft: (s.match(/:has\(/g) || []).length,
})
const idx = s.indexOf('.connection-copy .as-h1')
console.log('snippet', s.slice(Math.max(0, idx), idx + 180))
}