From a5a96fed315b16b9233f7a64a4baf347a7cff294 Mon Sep 17 00:00:00 2001 From: Yunfei He Date: Thu, 28 May 2026 17:40:25 +0800 Subject: [PATCH] chore: hoist text-measure import in yoga.ts; declare node>=22 engine Addresses PR #23 review: move the mid-file text-measure import to the top-level import block, and declare engines.node>=22 to match the upgraded text stack (cli-truncate@6, slice-ansi@9 require node>=22). --- packages/runtime/package.json | 3 +++ packages/runtime/src/host/yoga.ts | 3 +-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/runtime/package.json b/packages/runtime/package.json index e5dd82e..60e92fb 100644 --- a/packages/runtime/package.json +++ b/packages/runtime/package.json @@ -46,5 +46,8 @@ }, "peerDependencies": { "vue": "^3.4.0" + }, + "engines": { + "node": ">=22" } } diff --git a/packages/runtime/src/host/yoga.ts b/packages/runtime/src/host/yoga.ts index 80ad6dc..490d9c9 100644 --- a/packages/runtime/src/host/yoga.ts +++ b/packages/runtime/src/host/yoga.ts @@ -9,6 +9,7 @@ import type { TuiText, TuiTransform, } from "./nodes.ts"; +import { flattenLeaves, measureTextNatural, wrapText } from "./text-measure.ts"; type YogaCarrier = TuiRoot | TuiBox | TuiText | TuiStatic | TuiTransform; @@ -314,8 +315,6 @@ export function applyYogaProp(node: YogaCarrier, key: string, value: unknown): v // --- text measure binding ------------------------------------------------ -import { flattenLeaves, measureTextNatural, wrapText } from "./text-measure.ts"; - export function bindTextMeasure(text: TuiText): void { text.yoga.setMeasureFunc((availableWidth) => { const raw = flattenLeaves(text);