mirror of
https://github.com/zhigang1992/esbuild.git
synced 2026-04-29 09:55:58 +08:00
make compat-table emit go fmt compatible code
This commit is contained in:
@@ -171,7 +171,8 @@ function upper(text) {
|
||||
function writeInnerMap(obj) {
|
||||
const keys = Object.keys(obj).sort()
|
||||
const maxLength = keys.reduce((a, b) => Math.max(a, b.length + 1), 0)
|
||||
return keys.map(x => `\t\t${(upper(x) + ':').padEnd(maxLength)} {${obj[x].join(', ')}},\n`).join('')
|
||||
if (keys.length === 0) return '{}'
|
||||
return `{\n${keys.map(x => `\t\t${(upper(x) + ':').padEnd(maxLength)} {${obj[x].join(', ')}},`).join('\n')}\n\t}`
|
||||
}
|
||||
|
||||
fs.writeFileSync(__dirname + '/../internal/compat/table.go',
|
||||
@@ -196,8 +197,7 @@ func (features Feature) Has(feature Feature) bool {
|
||||
}
|
||||
|
||||
var Table = map[Feature]map[Engine][]int{
|
||||
${Object.keys(versions).sort().map(x => `\t${x}: {
|
||||
${writeInnerMap(versions[x])}\t},`).join('\n')}
|
||||
${Object.keys(versions).sort().map(x => `\t${x}: ${writeInnerMap(versions[x])},`).join('\n')}
|
||||
}
|
||||
|
||||
func isVersionLessThan(a []int, b []int) bool {
|
||||
|
||||
Reference in New Issue
Block a user