From ce52bf1912213aaa89dd96f7faee198b7415e6ff Mon Sep 17 00:00:00 2001 From: Gaubee Date: Tue, 20 Jan 2026 23:33:46 +0800 Subject: [PATCH] fix(build): key-utils as pure TS package + fix remote miniapp icon URLs - Change key-utils to export src/*.ts directly (no build needed) - Fix remote miniapp icon/screenshot URL handling with proper URL check - Absolute URLs (http/https) are preserved, relative paths use new URL() --- packages/key-utils/package.json | 18 ++++++++---------- scripts/vite-plugin-miniapps.ts | 7 ++++--- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/packages/key-utils/package.json b/packages/key-utils/package.json index 43179acbc..7cd87170d 100644 --- a/packages/key-utils/package.json +++ b/packages/key-utils/package.json @@ -3,23 +3,21 @@ "version": "0.1.0", "description": "Utility functions for KeyApp UI components", "type": "module", - "main": "./dist/index.cjs", - "module": "./dist/index.js", - "types": "./dist/index.d.ts", + "main": "./src/index.ts", + "module": "./src/index.ts", + "types": "./src/index.ts", "exports": { ".": { - "import": "./dist/index.js", - "require": "./dist/index.cjs", - "types": "./dist/index.d.ts" + "import": "./src/index.ts", + "types": "./src/index.ts" }, "./*": { - "import": "./dist/*.js", - "require": "./dist/*.cjs", - "types": "./dist/*.d.ts" + "import": "./src/*.ts", + "types": "./src/*.ts" } }, "files": [ - "dist" + "src" ], "scripts": { "build": "vite build", diff --git a/scripts/vite-plugin-miniapps.ts b/scripts/vite-plugin-miniapps.ts index 168dec972..e35e670bf 100644 --- a/scripts/vite-plugin-miniapps.ts +++ b/scripts/vite-plugin-miniapps.ts @@ -305,12 +305,13 @@ function scanRemoteMiniappsForBuild(miniappsPath: string): Array `./${entry.name}/${s}`) ?? [], + url: baseUrl, + icon: manifest.icon.startsWith('http') ? manifest.icon : new URL(manifest.icon, baseUrl).href, + screenshots: manifest.screenshots?.map((s) => (s.startsWith('http') ? s : new URL(s, baseUrl).href)) ?? [], }); } catch { console.warn(`[miniapps] ${entry.name}: invalid remote manifest.json, skipping`);