aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/app.js7
-rw-r--r--src/features/index.js16
2 files changed, 18 insertions, 5 deletions
diff --git a/src/app.js b/src/app.js
index 2c2a314..a7fed0f 100644
--- a/src/app.js
+++ b/src/app.js
@@ -9,10 +9,7 @@ import { qrSvg } from './qr.js';
import { scanQr } from './scan.js';
import { getSyncConfig, setSyncConfig, parseNostrPubkey, npubOf, fetchNostrProfile, decryptWithCode } from './nostr.js';
import { dataSources, getSource, setSource, getNetwork, setNetwork, NETWORKS } from './api.js';
-import { swapsFeature } from './features/swaps.js';
-import { giftsFeature } from './features/gifts.js';
-import { arkFeature } from './features/ark.js';
-import { spFeature } from './features/sp.js';
+import { buildFeatures } from './features/index.js';
import { t, LANGS, getLang, setLang, isRTL, loadLocale } from './i18n.js';
import {
fmtBtc,
@@ -2976,7 +2973,7 @@ const ctx = {
getAccounts: () => accounts,
claimTargets, enterWallet, activateAccount, commitAccount,
};
-const FEATURES = [giftsFeature, swapsFeature, arkFeature, spFeature].map((f) => f(ctx));
+const FEATURES = buildFeatures(ctx);
// apply text direction, then restore a wallet left open in this tab — otherwise
// show the unlock screen.
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)];
+}