'use strict'; const assert = require('node:assert/strict'); const fs = require('node:fs'); const path = require('node:path'); const vm = require('node:vm'); const roots = ['.', 'release/UNIVERSAL_SpineViewer']; function functionBody(source, name, nextName) { const start = source.indexOf(`\tfunction ${name}(`); const end = source.indexOf(`\n\tfunction ${nextName}(`, start + 1); assert.ok(start >= 0 && end > start, `missing function ${name}`); return source.slice(start, end); } for (const root of roots) { const viewerPath = path.join(root, 'viewer/spine.html'); const html = fs.readFileSync(viewerPath, 'utf8'); const script = html.match(/