| 1234567891011121314151617181920212223 |
- // 探查 textLayer 与 imageUrl 节点的真实字段
- import { readFileSync } from 'node:fs'
- const j = JSON.parse(readFileSync(process.argv[2], 'utf8'))
- let textSample = null
- let imgSample = null
- function walk(n) {
- if (!textSample && n.type === 'textLayer') textSample = n
- if (!imgSample && JSON.stringify(n).includes('imageUrl')) imgSample = n
- for (const c of n.layers || []) walk(c)
- }
- walk(j.artboard)
- if (textSample) {
- console.log('=== textLayer keys:', Object.keys(textSample).join(','))
- console.log(JSON.stringify(textSample, null, 1).slice(0, 1500))
- }
- if (imgSample) {
- console.log('\n=== node-with-imageUrl keys:', Object.keys(imgSample).join(','))
- const s = JSON.stringify(imgSample, null, 1)
- const i = s.indexOf('imageUrl')
- console.log(s.slice(Math.max(0, i - 600), i + 400))
- }
|