From 11b2a56a320bbd66b98991fd08478d154ff6c717 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Sat, 4 Jul 2026 09:10:04 -0700 Subject: Build profiles: HAL_FEATURES selects which features ship MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit build.js swaps src/features/index.js for a generated module importing only the enabled features (gifts,swaps,ark,sp — unset means all, "none" means a plain on-chain wallet), so excluded feature code and its network endpoints never enter the bundle. Minimal profile: 476KB vs 577KB, with the Ark/gRPC, Boltz, and MuSig2 code verifiably absent. `bun run build:minimal` builds it. tools/minimal-smoke.js proves the minimal profile end-to-end: no receive-mode dropdown, no gift button, no swap/Ark/SP settings cards, no page errors, and a plain on-chain receive still lands. The two blessed profiles are full (everything, the existing e2e suites) and minimal (this smoke test); other combos should work but aren't CI'd. Gift and SP primitives still live inside wallet.js, so those bytes remain in the minimal bundle for now — extracting them is the next step if we want the core leaner still. Co-Authored-By: Claude Fable 5 Claude-Session: https://claude.ai/code/session_01QFAcD4V284DvYZZHP7Rxxy --- src/features/index.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 src/features/index.js (limited to 'src/features') diff --git a/src/features/index.js b/src/features/index.js new file mode 100644 index 0000000..590020a --- /dev/null +++ b/src/features/index.js @@ -0,0 +1,16 @@ +// Which optional features this build includes. In dev (and by default in +// builds) everything is on. Release builds can exclude features entirely: +// build.js replaces this module's contents based on HAL_FEATURES, so a +// disabled feature's code — and its network endpoints — never enters the +// bundle. See featureIndexSource() in build.js. + +import { giftsFeature } from './gifts.js'; +import { swapsFeature } from './swaps.js'; +import { arkFeature } from './ark.js'; +import { spFeature } from './sp.js'; + +// NB order is meaningful where hooks stack: gifts' receive takeover and +// balance line come before ark's, matching the pre-plugin layout. +export function buildFeatures(ctx) { + return [giftsFeature(ctx), swapsFeature(ctx), arkFeature(ctx), spFeature(ctx)]; +} -- cgit v1.2.3