diff --git a/rollup.config.js b/rollup.config.js index e758a73..cdf9f1c 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -1,7 +1,11 @@ import inject from '@rollup/plugin-inject'; +import replace from '@rollup/plugin-replace'; import typescript from 'rollup-plugin-typescript2'; +import { readFile } from 'node:fs/promises'; import { fileURLToPath } from 'node:url'; +const pkg = JSON.parse(await readFile('package.json')); + const commonPlugins = () => [ typescript(), inject( @@ -14,7 +18,11 @@ const commonPlugins = () => [ ) ) ), - + replace({ + 'self.BARE_MUX_VERSION': JSON.stringify( + pkg.version + ), + }), ]; const configs = [ diff --git a/src/index.ts b/src/index.ts index ca2466f..84def16 100644 --- a/src/index.ts +++ b/src/index.ts @@ -8,3 +8,6 @@ export type * from './baretypes'; export type * from './client'; export type * from './connection'; export type * from "./snapshot"; + +//@ts-expect-error this gets filled in +console.debug("bare mux version: " + self.BARE_MUX_VERSION); \ No newline at end of file