Something went wrong. Try again.
Something went wrong. Try again.
1234567891011121314151617181920212223242526272829303132333435#!/usr/bin/env node// Verify a generated Daevix.Script SVG still carries its message: run the// handoff bundle's own Daevix.decodeScript over the file and compare.//// Usage: node hack/check-script.js --svg <file> --message <expected>
'use strict';const fs = require('fs');const path = require('path');
function arg(name) { const i = process.argv.indexOf('--' + name); return i < 0 ? undefined : process.argv[i + 1];}
const svgPath = arg('svg');const want = arg('message');if (!svgPath || want === undefined) { console.error('usage: check-script.js --svg <file> --message <expected>'); process.exit(2);}
global.window = global;global.React = require(path.join(__dirname, 'vendor', 'react.production.min.js'));require(path.join(__dirname, 'vendor', 'bundle.js'));const svg = fs.readFileSync(svgPath, 'utf8');const got = global.window.Daevix.decodeScript(svg);if (!got || got.text !== want) { console.error('FAIL ' + svgPath + ': decodeScript returned ' + (got ? JSON.stringify(got.text) : 'null') + ', want ' + JSON.stringify(want)); process.exit(1);}console.log('ok ' + svgPath + ' -> ' + JSON.stringify(got.text) + ' (' + got.cols + 'x' + got.rows + ', capacity ' + got.capacity + ' bytes)');