File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ import { readFileSync } from 'node:fs'
2+ import { resolve , dirname } from 'node:path'
3+ import { fileURLToPath } from 'node:url'
4+
5+ const __dirname = dirname ( fileURLToPath ( import . meta. url ) )
6+ const pkgPath = resolve ( __dirname , '..' , 'package.json' )
7+ const pkg = JSON . parse ( readFileSync ( pkgPath , 'utf-8' ) )
8+
19/**
210 * Shared MACRO define map used by both dev.ts (runtime -d flags)
311 * and build.ts (Bun.build define option).
412 *
513 * Each value is a JSON-stringified expression that replaces the
614 * corresponding MACRO.* identifier at transpile / bundle time.
15+ *
16+ * VERSION is read from package.json to avoid version drift.
717 */
818export function getMacroDefines ( ) : Record < string , string > {
919 return {
10- 'MACRO.VERSION' : JSON . stringify ( '2.1.888' ) ,
20+ 'MACRO.VERSION' : JSON . stringify ( pkg . version ) ,
1121 'MACRO.BUILD_TIME' : JSON . stringify ( new Date ( ) . toISOString ( ) ) ,
1222 'MACRO.FEEDBACK_CHANNEL' : JSON . stringify ( '' ) ,
1323 'MACRO.ISSUES_EXPLAINER' : JSON . stringify ( '' ) ,
You can’t perform that action at this time.
0 commit comments