waybetter-for-x/apps/desktop/scripts/build-inject.mjs
2026-10-01 06:01:13 +07:00

19 lines
923 B
JavaScript

import { buildRuntime, watchRequested } from '../../../waybetter/packages/waybetter/build/runtime.mjs';
// The X runtime, bundled by the framework (`waybetter/build`): `?inline` CSS as strings, other CSS
// imports dropped (the injected UI adopts its stylesheet into a shadow root explicitly), and
// English only for its own strings: `x.*` and the bundled plugins' `plugin.*` (the UI kit's `kit.*`
// come from the framework catalog). Other languages arrive natively.
const watch = watchRequested();
await buildRuntime({
watch,
entry: 'src/inject/entry.tsx',
outfile: 'src-tauri/x-runtime.js',
catalog: 'locales/en.json',
prefixes: ['x.', 'plugin.'],
jsx: 'automatic',
define: { 'process.env.NODE_ENV': '"production"' },
// Theme fonts are embedded as bytes (see src/inject/fonts.ts).
loader: { '.woff2': 'base64' },
});
console.log(watch ? 'Watching X runtime.' : 'Built X runtime.');