Files
nixpkgs/pkgs/by-name/rs/rsshub/0002-fix-network-call.patch
2026-03-10 13:39:36 +08:00

32 lines
1.1 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: RSSHub Nix packagers
Date: Mon, 10 Mar 2026 00:00:00 +0000
Subject: [PATCH] support BUILD_ROUTES_MODE for offline builds
Add BUILD_ROUTES_MODE environment variable support to lib/registry.ts
so that route metadata can be built using directoryImport without
executing module-level code that would trigger network requests.
This is required for building in the Nix sandbox (no network access).
---
lib/registry.ts | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/lib/registry.ts b/lib/registry.ts
--- a/lib/registry.ts
+++ b/lib/registry.ts
@@ -56,7 +56,12 @@
let namespaces: NamespacesType = {};
-if (config.isPackage) {
+if (process.env.BUILD_ROUTES_MODE) {
+ modules = directoryImport({
+ targetDirectoryPath: path.join(__dirname, './routes'),
+ importPattern: /\.tsx?$/,
+ }) as typeof modules;
+} else if (config.isPackage) {
namespaces = (await import('../assets/build/routes.js')).default;
} else {
switch (process.env.NODE_ENV || process.env.VERCEL_ENV) {