/**
 * Bun preload script for dev mode.
 * Defines MACRO globals that are normally inlined at build time.
 */
declare global {
  var MACRO: { VERSION: string; BUILD_TIME: string }
}

// Read version from package.json
const pkg = JSON.parse(
  require('fs').readFileSync(require('path').join(__dirname, '..', 'package.json'), 'utf8'),
)

globalThis.MACRO = {
  VERSION: process.env.SANDCODE_VERSION || pkg.version,
  BUILD_TIME: new Date().toISOString(),
}
