@finesoft/front 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser.d.mts +2 -2
- package/dist/browser.mjs +1 -1
- package/dist/index.d.mts +140 -2
- package/dist/index.mjs +15 -15
- package/dist/{server-data-DQzknR97.d.mts → server-data-HVSgxEac.d.mts} +701 -2
- package/dist/src-BI4eMjHk.mjs +2 -0
- package/docs/11-navigation.md +355 -0
- package/docs/zh/11-navigation.md +355 -0
- package/package.json +3 -3
- package/dist/start-app-S4DH-40i.mjs +0 -2
package/dist/browser.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { $ as
|
|
2
|
-
export { ACTION_KINDS, Action, ActionDispatcher, ActionHandler, type ActionHandlerDependencies, AfterLoadGuard, AsyncMapper, BASE_PAGE_FIELDS, BaseController, BaseItem, BaseLogger, BasePage, BaseShelf, BeforeLoadGuard, type BrowserAppConfig, BrowserContextOptions, CompositeEventRecorder, CompositeLogger, CompositeLoggerFactory, CompoundAction, ConsoleEventRecorder, ConsoleLogger, ConsoleLoggerFactory, Container, DEP_KEYS, DefineRoutesOptions, DenyResult, EventRecorder, ExternalUrlAction, type ExternalUrlDependencies, ExtractParamNames, FINESOFT_PUBLIC, FeatureFlags, FeatureFlagsProvider, FlowAction, type FlowActionCallbacks, type FlowActionDependencies, Framework, FrameworkConfig, History, HostCheckResult, HostGuardError, HttpClient, HttpClientConfig, HttpError, ImpressionEntry, ImpressionObserver, ImpressionObserverOptions, InferOutput, InferParams, InferQuery, Intent, IntentController, IntentDispatcher, IntersectionImpressionObserver, LocaleAttributes, LocaleInfo, Logger, Logger as LoggerInterface, LoggerFactory, LruMap, MakeDependenciesOptions, Mapper, MessagesLoader, MessagesLoaderContext, MetricsFieldsProvider, MetricsRecorder, MiddlewareResult, NavigationContext, Net, NextResult, None, NumOptions, Optional, PWADisplayMode, ParamSchema, ParamsFor, PlatformInfo, PluralCategory, PluralRuleProvider, PostLoadContext, PrefetchedIntent, PrefetchedIntents, QuerySchemaMap, RedirectResult, RenderMode, ReportCallback, ReportingLogger, ReportingLoggerFactory, ReportingLoggerOptions, RequestInterceptor, RequestScopedKey, ResponseInterceptor, RewriteResult, RouteAddOptions, RouteDefinition, RouteMatch, Router, SafeErrorPageOptions, SecureFetchOptions, ServerContextOptions, SimpleTranslator, SimpleTranslatorOptions, StandardIssue, StandardResult, StandardSchemaV1, Storage, StrOptions, StripOptional, TextDirection, TranslationMessages, Translator, VoidEventRecorder, WithFieldsRecorder, bool, buildUrl, classifyHost, classifyUrl, createBrowserContext, createPrefetchedIntentsFromDom, createServerContext, defineRequestScopedKey, defineRoutes, deny, deserializeServerData, detectPlatform, englishPlural, generateUuid, getBaseUrl, getLocaleAttributes, getPWADisplayMode, getPublicFields, getTextDirection, int, interpolate, isCompoundAction, isExternalUrlAction, isFlowAction, isNone, isPublicMarked, isRtl, isSome, makeDependencies, makeExternalUrlAction, makeFlowAction, makeLocaleInfo, makeSchema, mapEach, markPublic, next, num, oneOf, optional, pipe, pipeAsync, redirect, registerActionHandlers, registerExternalUrlHandler, registerFlowActionHandler, removeHost, removeQueryParams, removeScheme, resetFilterCache, resolveConfiguredMessages, resolveLocaleFromUrl, resolveMessages, resolvePluralKey, rewrite, route, runAfterLoadGuards, runBeforeLoadGuards, runStandard, safeErrorPage, secureFetch, setHtmlLocaleAttributes, shouldLog, stableStringify, startBrowserApp, str, tryScroll, uuid, withDefault };
|
|
1
|
+
import { $ as isNone, $n as Framework, $r as BASE_PAGE_FIELDS, $t as popToRoot, A as resolvePluralKey, Ai as BaseLogger, An as SplitVisibility, Ar as RouteAddOptions, At as createNavigationController, B as ServerContextOptions, Bi as ActionHandler, Bn as classifyHost, Br as AfterLoadGuard, Bt as SerializedNavigation, C as makeLocaleInfo, Ci as ImpressionEntry, Cn as NavigationPathStep, Cr as bool, Ct as PopToRootOperation, D as PluralRuleProvider, Di as ReportingLogger, Dn as SPLIT_VISIBILITIES, Dr as str, Dt as SelectColumnOperation, E as PluralCategory, Ei as ReportCallback, En as ResolvedDestination, Er as oneOf, Et as ReplaceTopOperation, F as ConsoleEventRecorder, Fi as IntentDispatcher, Fn as mapEach, Fr as StandardIssue, Ft as createActiveLeafCodec, G as getBaseUrl, Gi as FlowAction, Gn as HttpError, Gr as NextResult, Gt as deserializeNavigation, H as createServerContext, Hi as Action, Hn as HostGuardError, Hr as DenyResult, Ht as SerializedSplitColumn, I as CompositeEventRecorder, Ii as Intent, In as pipe, Ir as StandardResult, It as createFullStateCodec, J as removeScheme, Ji as isFlowAction, Jn as stableStringify, Jr as RewriteResult, Jt as collectVisibleDestinations, K as removeHost, Ki as isCompoundAction, Kn as RequestInterceptor, Kr as PostLoadContext, Kt as serializeNavigation, L as runAfterLoadGuards, Li as IntentController, Ln as pipeAsync, Lr as StandardSchemaV1, Lt as decodeNavigationTreeParam, M as VoidEventRecorder, Mi as LoggerFactory, Mn as TabsNode, Mr as Router, Mt as FullStateCodecOptions, N as ImpressionObserverOptions, Ni as SecureFetchOptions, Nn as AsyncMapper, Nr as InferOutput, Nt as NavigationCodec, O as englishPlural, Oi as ReportingLoggerFactory, On as SplitColumn, Or as uuid, Ot as SelectTabOperation, P as IntersectionImpressionObserver, Pi as secureFetch, Pn as Mapper, Pr as ParamSchema, Pt as NavigationRouterLike, Q as Optional, Qn as safeErrorPage, Qr as rewrite, Qt as popTo, R as runBeforeLoadGuards, Ri as Container, Rn as BaseController, Rr as makeSchema, Rt as encodeNavigationTreeParam, S as isRtl, Si as EventRecorder, Sn as NavigationPath, Sr as StrOptions, St as PopToOperation, T as setHtmlLocaleAttributes, Ti as MetricsFieldsProvider, Tn as Page, Tr as num, Tt as PushOptions, U as generateUuid, Ui as CompoundAction, Un as HttpClient, Ur as MiddlewareResult, Ut as SerializedStack, V as createBrowserContext, Vi as ACTION_KINDS, Vn as classifyUrl, Vr as BeforeLoadGuard, Vt as SerializedSplit, W as buildUrl, Wi as ExternalUrlAction, Wn as HttpClientConfig, Wr as NavigationContext, Wt as SerializedTabs, X as getPWADisplayMode, Xi as makeFlowAction, Xn as BaseShelf, Xr as next, Xt as findNode, Y as PWADisplayMode, Yi as makeExternalUrlAction, Yn as BaseItem, Yr as deny, Yt as findNearestStack, Z as None, Zn as SafeErrorPageOptions, Zr as redirect, Zt as pop, _ as registerExternalUrlHandler, _i as TranslationMessages, _n as LeafNode, _r as QuerySchemaMap, _t as NavigationControllerOptions, a as BrowserAppConfig, ai as RequestScopedKey, an as setVisibility, ar as TextDirection, at as defineRoutes, b as getLocaleAttributes, bi as PlatformInfo, bn as NavigationNode, br as withDefault, bt as NavigationOperation, c as NavigationBridgeDependencies, ci as FeatureFlags, cn as TabsInit, cr as shouldLog, ct as NavigationBrowserConfig, d as ActionHandlerDependencies, di as MetricsRecorder, dn as isStackNode, dr as CompositeLogger, dt as NavigationSSRDefinition, ei as BasePage, en as push, er as FrameworkConfig, et as isSome, f as registerActionHandlers, fi as Net, fn as isTabsNode, fr as CompositeLoggerFactory, ft as defineNavigation, g as ExternalUrlDependencies, gi as MessagesLoaderContext, gn as tabs, gr as ParamsFor, gt as NavigationController, h as registerFlowActionHandler, hi as MessagesLoader, hn as stack, hr as InferQuery, ht as NavigationContextInput, i as History, ii as markPublic, in as selectTab, ir as LocaleInfo, it as RouteDefinition, j as WithFieldsRecorder, ji as Logger, jn as StackNode, jr as RouteMatch, jt as DEFAULT_NAV_PARAM, k as interpolate, ki as ReportingLoggerOptions, kn as SplitNode, kr as RouteParams, kt as SetVisibilityOperation, l as NavigationHandle, li as FeatureFlagsProvider, ln as isLeafNode, lr as ConsoleLogger, lt as NavigationDefinition, m as FlowActionDependencies, mi as makeDependencies, mn as split, mr as InferParams, mt as NAVIGATION_OP_KINDS, n as deserializeServerData, ni as getPublicFields, nn as resolveActivePath, nr as PrefetchedIntents, nt as DefineRoutesOptions, o as BrowserNavigationConfig, oi as defineRequestScopedKey, on as visibleSplitColumns, or as Translator, ot as route, p as FlowActionCallbacks, pi as Storage, pn as leaf, pr as ExtractParamNames, pt as HydrateOperation, q as removeQueryParams, qi as isExternalUrlAction, qn as ResponseInterceptor, qr as RedirectResult, qt as serializeNavigationStable, r as tryScroll, ri as isPublicMarked, rn as selectColumn, rr as LocaleAttributes, rt as RenderMode, s as startBrowserApp, si as DEP_KEYS, sn as SplitColumnInit, sr as resetFilterCache, st as DefineNavigationOptions, t as createPrefetchedIntentsFromDom, ti as FINESOFT_PUBLIC, tn as replaceTop, tr as PrefetchedIntent, tt as LruMap, u as createNavigationBridge, ui as MakeDependenciesOptions, un as isSplitNode, ur as ConsoleLoggerFactory, ut as NavigationInitial, v as SimpleTranslator, vi as resolveConfiguredMessages, vn as NAVIGATION_NODE_KINDS, vr as StripOptional, vt as NavigationDispatchContext, w as resolveLocaleFromUrl, wi as ImpressionObserver, wn as NavigationSnapshot, wr as int, wt as PushOperation, x as getTextDirection, xi as detectPlatform, xn as NavigationNodeKind, xr as NumOptions, xt as PopOperation, y as SimpleTranslatorOptions, yi as resolveMessages, yn as NavigationError, yr as optional, yt as NavigationOpKind, z as BrowserContextOptions, zi as ActionDispatcher, zn as HostCheckResult, zr as runStandard, zt as SerializedLeaf } from "./server-data-HVSgxEac.mjs";
|
|
2
|
+
export { ACTION_KINDS, Action, ActionDispatcher, ActionHandler, type ActionHandlerDependencies, AfterLoadGuard, AsyncMapper, BASE_PAGE_FIELDS, BaseController, BaseItem, BaseLogger, BasePage, BaseShelf, BeforeLoadGuard, type BrowserAppConfig, BrowserContextOptions, type BrowserNavigationConfig, CompositeEventRecorder, CompositeLogger, CompositeLoggerFactory, CompoundAction, ConsoleEventRecorder, ConsoleLogger, ConsoleLoggerFactory, Container, DEFAULT_NAV_PARAM, DEP_KEYS, DefineNavigationOptions, DefineRoutesOptions, DenyResult, EventRecorder, ExternalUrlAction, type ExternalUrlDependencies, ExtractParamNames, FINESOFT_PUBLIC, FeatureFlags, FeatureFlagsProvider, FlowAction, type FlowActionCallbacks, type FlowActionDependencies, Framework, FrameworkConfig, FullStateCodecOptions, History, HostCheckResult, HostGuardError, HttpClient, HttpClientConfig, HttpError, HydrateOperation, ImpressionEntry, ImpressionObserver, ImpressionObserverOptions, InferOutput, InferParams, InferQuery, Intent, IntentController, IntentDispatcher, IntersectionImpressionObserver, LeafNode, LocaleAttributes, LocaleInfo, Logger, Logger as LoggerInterface, LoggerFactory, LruMap, MakeDependenciesOptions, Mapper, MessagesLoader, MessagesLoaderContext, MetricsFieldsProvider, MetricsRecorder, MiddlewareResult, NAVIGATION_NODE_KINDS, NAVIGATION_OP_KINDS, type NavigationBridgeDependencies, NavigationBrowserConfig, NavigationCodec, NavigationContext, NavigationContextInput, NavigationController, NavigationControllerOptions, NavigationDefinition, NavigationDispatchContext, NavigationError, type NavigationHandle, NavigationInitial, NavigationNode, NavigationNodeKind, NavigationOpKind, NavigationOperation, NavigationPath, NavigationPathStep, NavigationRouterLike, NavigationSSRDefinition, NavigationSnapshot, Net, NextResult, None, NumOptions, Optional, PWADisplayMode, Page, ParamSchema, ParamsFor, PlatformInfo, PluralCategory, PluralRuleProvider, PopOperation, PopToOperation, PopToRootOperation, PostLoadContext, PrefetchedIntent, PrefetchedIntents, PushOperation, PushOptions, QuerySchemaMap, RedirectResult, RenderMode, ReplaceTopOperation, ReportCallback, ReportingLogger, ReportingLoggerFactory, ReportingLoggerOptions, RequestInterceptor, RequestScopedKey, ResolvedDestination, ResponseInterceptor, RewriteResult, RouteAddOptions, RouteDefinition, RouteMatch, RouteParams, Router, SPLIT_VISIBILITIES, SafeErrorPageOptions, SecureFetchOptions, SelectColumnOperation, SelectTabOperation, SerializedLeaf, SerializedNavigation, SerializedSplit, SerializedSplitColumn, SerializedStack, SerializedTabs, ServerContextOptions, SetVisibilityOperation, SimpleTranslator, SimpleTranslatorOptions, SplitColumn, SplitColumnInit, SplitNode, SplitVisibility, StackNode, StandardIssue, StandardResult, StandardSchemaV1, Storage, StrOptions, StripOptional, TabsInit, TabsNode, TextDirection, TranslationMessages, Translator, VoidEventRecorder, WithFieldsRecorder, bool, buildUrl, classifyHost, classifyUrl, collectVisibleDestinations, createActiveLeafCodec, createBrowserContext, createFullStateCodec, createNavigationBridge, createNavigationController, createPrefetchedIntentsFromDom, createServerContext, decodeNavigationTreeParam, defineNavigation, defineRequestScopedKey, defineRoutes, deny, deserializeNavigation, deserializeServerData, detectPlatform, encodeNavigationTreeParam, englishPlural, findNearestStack, findNode, generateUuid, getBaseUrl, getLocaleAttributes, getPWADisplayMode, getPublicFields, getTextDirection, int, interpolate, isCompoundAction, isExternalUrlAction, isFlowAction, isLeafNode, isNone, isPublicMarked, isRtl, isSome, isSplitNode, isStackNode, isTabsNode, leaf, makeDependencies, makeExternalUrlAction, makeFlowAction, makeLocaleInfo, makeSchema, mapEach, markPublic, next, num, oneOf, optional, pipe, pipeAsync, pop, popTo, popToRoot, push, redirect, registerActionHandlers, registerExternalUrlHandler, registerFlowActionHandler, removeHost, removeQueryParams, removeScheme, replaceTop, resetFilterCache, resolveActivePath, resolveConfiguredMessages, resolveLocaleFromUrl, resolveMessages, resolvePluralKey, rewrite, route, runAfterLoadGuards, runBeforeLoadGuards, runStandard, safeErrorPage, secureFetch, selectColumn, selectTab, serializeNavigation, serializeNavigationStable, setHtmlLocaleAttributes, setVisibility, shouldLog, split, stableStringify, stack, startBrowserApp, str, tabs, tryScroll, uuid, visibleSplitColumns, withDefault };
|
package/dist/browser.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{$ as e
|
|
1
|
+
import{$ as e,$t as t,A as n,At as r,B as i,Bt as a,C as o,Cn as s,Ct as c,D as l,Dt as u,E as d,Et as f,F as p,Ft as m,G as h,Gt as g,H as _,Ht as v,I as y,It as b,J as x,Jt as S,K as C,Kt as w,L as T,Lt as E,M as D,Mt as O,N as k,Nt as A,O as j,Ot as M,P as N,Pt as P,Q as F,Qt as I,R as L,Rt as R,S as z,Sn as B,St as V,T as H,Tn as U,Tt as W,U as G,Ut as K,V as q,Vt as J,W as Y,Wt as X,X as Z,Xt as Q,Y as $,Yt as ee,Z as te,Zt as ne,_ as re,_n as ie,_t as ae,a as oe,an as se,at as ce,b as le,bn as ue,bt as de,c as fe,cn as pe,ct as me,d as he,dn as ge,dt as _e,en as ve,et as ye,f as be,fn as xe,ft as Se,g as Ce,gn as we,gt as Te,h as Ee,hn as De,ht as Oe,i as ke,in as Ae,it as je,j as Me,jt as Ne,k as Pe,kt as Fe,l as Ie,ln as Le,lt as Re,m as ze,mn as Be,mt as Ve,n as He,nn as Ue,nt as We,o as Ge,on as Ke,ot as qe,p as Je,pn as Ye,pt as Xe,q as Ze,qt as Qe,r as $e,rn as et,rt as tt,s as nt,sn as rt,st as it,t as at,tn as ot,tt as st,u as ct,un as lt,ut,v as dt,vn as ft,vt as pt,w as mt,wn as ht,wt as gt,x as _t,xn as vt,xt as yt,y as bt,yn as xt,yt as St,z as Ct,zt as wt}from"./src-BI4eMjHk.mjs";export{ue as ACTION_KINDS,xt as ActionDispatcher,pt as BASE_PAGE_FIELDS,Te as BaseController,Q as BaseLogger,Je as CompositeEventRecorder,ne as CompositeLogger,I as CompositeLoggerFactory,K as ConsoleEventRecorder,w as ConsoleLogger,Qe as ConsoleLoggerFactory,ie as Container,p as DEFAULT_NAV_PARAM,a as DEP_KEYS,St as FINESOFT_PUBLIC,c as Framework,nt as History,xe as HostGuardError,Ye as HttpClient,Be as HttpError,ft as IntentDispatcher,be as IntersectionImpressionObserver,Pe as LruMap,ut as NAVIGATION_NODE_KINDS,k as NAVIGATION_OP_KINDS,_e as NavigationError,gt as PrefetchedIntents,X as ReportingLogger,g as ReportingLoggerFactory,b as Router,Se as SPLIT_VISIBILITIES,t as SimpleTranslator,he as VoidEventRecorder,ct as WithFieldsRecorder,r as bool,_t as buildUrl,De as classifyHost,we as classifyUrl,G as collectVisibleDestinations,y as createActiveLeafCodec,dt as createBrowserContext,T as createFullStateCodec,ke as createNavigationBridge,N as createNavigationController,He as createPrefetchedIntentsFromDom,bt as createServerContext,L as decodeNavigationTreeParam,D as defineNavigation,wt as defineRequestScopedKey,n as defineRoutes,ze as deny,i as deserializeNavigation,$e as deserializeServerData,v as detectPlatform,Ct as encodeNavigationTreeParam,ve as englishPlural,Y as findNearestStack,h as findNode,le as generateUuid,z as getBaseUrl,se as getLocaleAttributes,d as getPWADisplayMode,de as getPublicFields,Ke as getTextDirection,Ne as int,ot as interpolate,vt as isCompoundAction,B as isExternalUrlAction,s as isFlowAction,We as isLeafNode,l as isNone,yt as isPublicMarked,rt as isRtl,j as isSome,tt as isSplitNode,je as isStackNode,ce as isTabsNode,qe as leaf,J as makeDependencies,ht as makeExternalUrlAction,U as makeFlowAction,pe as makeLocaleInfo,E as makeSchema,Xe as mapEach,V as markPublic,Ee as next,O as num,A as oneOf,M as optional,Ve as pipe,Oe as pipeAsync,C as pop,Ze as popTo,x as popToRoot,$ as push,Ce as redirect,oe as registerActionHandlers,Ie as registerExternalUrlHandler,Ge as registerFlowActionHandler,o as removeHost,mt as removeQueryParams,H as removeScheme,Z as replaceTop,S as resetFilterCache,te as resolveActivePath,et as resolveConfiguredMessages,Le as resolveLocaleFromUrl,Ae as resolveMessages,Ue as resolvePluralKey,re as rewrite,Me as route,f as runAfterLoadGuards,u as runBeforeLoadGuards,R as runStandard,ae as safeErrorPage,ge as secureFetch,F as selectColumn,e as selectTab,q as serializeNavigation,_ as serializeNavigationStable,lt as setHtmlLocaleAttributes,ye as setVisibility,ee as shouldLog,it as split,W as stableStringify,me as stack,at as startBrowserApp,P as str,Re as tabs,fe as tryScroll,m as uuid,st as visibleSplitColumns,Fe as withDefault};
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as
|
|
1
|
+
import { $ as isNone, $n as Framework, $r as BASE_PAGE_FIELDS, $t as popToRoot, A as resolvePluralKey, Ai as BaseLogger, An as SplitVisibility, Ar as RouteAddOptions, At as createNavigationController, B as ServerContextOptions, Bi as ActionHandler, Bn as classifyHost, Br as AfterLoadGuard, Bt as SerializedNavigation, C as makeLocaleInfo, Ci as ImpressionEntry, Cn as NavigationPathStep, Cr as bool, Ct as PopToRootOperation, D as PluralRuleProvider, Di as ReportingLogger, Dn as SPLIT_VISIBILITIES, Dr as str, Dt as SelectColumnOperation, E as PluralCategory, Ei as ReportCallback, En as ResolvedDestination, Er as oneOf, Et as ReplaceTopOperation, F as ConsoleEventRecorder, Fi as IntentDispatcher, Fn as mapEach, Fr as StandardIssue, Ft as createActiveLeafCodec, G as getBaseUrl, Gi as FlowAction, Gn as HttpError, Gr as NextResult, Gt as deserializeNavigation, H as createServerContext, Hi as Action, Hn as HostGuardError, Hr as DenyResult, Ht as SerializedSplitColumn, I as CompositeEventRecorder, Ii as Intent, In as pipe, Ir as StandardResult, It as createFullStateCodec, J as removeScheme, Ji as isFlowAction, Jn as stableStringify, Jr as RewriteResult, Jt as collectVisibleDestinations, K as removeHost, Ki as isCompoundAction, Kn as RequestInterceptor, Kr as PostLoadContext, Kt as serializeNavigation, L as runAfterLoadGuards, Li as IntentController, Ln as pipeAsync, Lr as StandardSchemaV1, Lt as decodeNavigationTreeParam, M as VoidEventRecorder, Mi as LoggerFactory, Mn as TabsNode, Mr as Router, Mt as FullStateCodecOptions, N as ImpressionObserverOptions, Ni as SecureFetchOptions, Nn as AsyncMapper, Nr as InferOutput, Nt as NavigationCodec, O as englishPlural, Oi as ReportingLoggerFactory, On as SplitColumn, Or as uuid, Ot as SelectTabOperation, P as IntersectionImpressionObserver, Pi as secureFetch, Pn as Mapper, Pr as ParamSchema, Pt as NavigationRouterLike, Q as Optional, Qn as safeErrorPage, Qr as rewrite, Qt as popTo, R as runBeforeLoadGuards, Ri as Container, Rn as BaseController, Rr as makeSchema, Rt as encodeNavigationTreeParam, S as isRtl, Si as EventRecorder, Sn as NavigationPath, Sr as StrOptions, St as PopToOperation, T as setHtmlLocaleAttributes, Ti as MetricsFieldsProvider, Tn as Page, Tr as num, Tt as PushOptions, U as generateUuid, Ui as CompoundAction, Un as HttpClient, Ur as MiddlewareResult, Ut as SerializedStack, V as createBrowserContext, Vi as ACTION_KINDS, Vn as classifyUrl, Vr as BeforeLoadGuard, Vt as SerializedSplit, W as buildUrl, Wi as ExternalUrlAction, Wn as HttpClientConfig, Wr as NavigationContext, Wt as SerializedTabs, X as getPWADisplayMode, Xi as makeFlowAction, Xn as BaseShelf, Xr as next, Xt as findNode, Y as PWADisplayMode, Yi as makeExternalUrlAction, Yn as BaseItem, Yr as deny, Yt as findNearestStack, Z as None, Zn as SafeErrorPageOptions, Zr as redirect, Zt as pop, _ as registerExternalUrlHandler, _i as TranslationMessages, _n as LeafNode, _r as QuerySchemaMap, _t as NavigationControllerOptions, a as BrowserAppConfig, ai as RequestScopedKey, an as setVisibility, ar as TextDirection, at as defineRoutes, b as getLocaleAttributes, bi as PlatformInfo, bn as NavigationNode, br as withDefault, bt as NavigationOperation, c as NavigationBridgeDependencies, ci as FeatureFlags, cn as TabsInit, cr as shouldLog, ct as NavigationBrowserConfig, d as ActionHandlerDependencies, di as MetricsRecorder, dn as isStackNode, dr as CompositeLogger, dt as NavigationSSRDefinition, ei as BasePage, en as push, er as FrameworkConfig, et as isSome, f as registerActionHandlers, fi as Net, fn as isTabsNode, fr as CompositeLoggerFactory, ft as defineNavigation, g as ExternalUrlDependencies, gi as MessagesLoaderContext, gn as tabs, gr as ParamsFor, gt as NavigationController, h as registerFlowActionHandler, hi as MessagesLoader, hn as stack, hr as InferQuery, ht as NavigationContextInput, i as History, ii as markPublic, in as selectTab, ir as LocaleInfo, it as RouteDefinition, j as WithFieldsRecorder, ji as Logger, jn as StackNode, jr as RouteMatch, jt as DEFAULT_NAV_PARAM, k as interpolate, ki as ReportingLoggerOptions, kn as SplitNode, kr as RouteParams, kt as SetVisibilityOperation, l as NavigationHandle, li as FeatureFlagsProvider, ln as isLeafNode, lr as ConsoleLogger, lt as NavigationDefinition, m as FlowActionDependencies, mi as makeDependencies, mn as split, mr as InferParams, mt as NAVIGATION_OP_KINDS, n as deserializeServerData, ni as getPublicFields, nn as resolveActivePath, nr as PrefetchedIntents, nt as DefineRoutesOptions, o as BrowserNavigationConfig, oi as defineRequestScopedKey, on as visibleSplitColumns, or as Translator, ot as route, p as FlowActionCallbacks, pi as Storage, pn as leaf, pr as ExtractParamNames, pt as HydrateOperation, q as removeQueryParams, qi as isExternalUrlAction, qn as ResponseInterceptor, qr as RedirectResult, qt as serializeNavigationStable, r as tryScroll, ri as isPublicMarked, rn as selectColumn, rr as LocaleAttributes, rt as RenderMode, s as startBrowserApp, si as DEP_KEYS, sn as SplitColumnInit, sr as resetFilterCache, st as DefineNavigationOptions, t as createPrefetchedIntentsFromDom, ti as FINESOFT_PUBLIC, tn as replaceTop, tr as PrefetchedIntent, tt as LruMap, u as createNavigationBridge, ui as MakeDependenciesOptions, un as isSplitNode, ur as ConsoleLoggerFactory, ut as NavigationInitial, v as SimpleTranslator, vi as resolveConfiguredMessages, vn as NAVIGATION_NODE_KINDS, vr as StripOptional, vt as NavigationDispatchContext, w as resolveLocaleFromUrl, wi as ImpressionObserver, wn as NavigationSnapshot, wr as int, wt as PushOperation, x as getTextDirection, xi as detectPlatform, xn as NavigationNodeKind, xr as NumOptions, xt as PopOperation, y as SimpleTranslatorOptions, yi as resolveMessages, yn as NavigationError, yr as optional, yt as NavigationOpKind, z as BrowserContextOptions, zi as ActionDispatcher, zn as HostCheckResult, zr as runStandard, zt as SerializedLeaf } from "./server-data-HVSgxEac.mjs";
|
|
2
2
|
import { Hono } from "hono";
|
|
3
3
|
import * as _$node_fs0 from "node:fs";
|
|
4
4
|
import { ViteDevServer } from "vite";
|
|
@@ -136,6 +136,144 @@ declare function injectCSRShell(template: string, locale?: {
|
|
|
136
136
|
dir: string;
|
|
137
137
|
}): string;
|
|
138
138
|
//#endregion
|
|
139
|
+
//#region ../ssr/src/navigation.d.ts
|
|
140
|
+
/**
|
|
141
|
+
* 哨兵 intent id —— 用来在 `serverData` 里夹带序列化的导航树。
|
|
142
|
+
*
|
|
143
|
+
* 取一个真实路由绝不会产出的保留 id(带 `@finesoft/` 前缀),因此不会与任何应用
|
|
144
|
+
* intent 撞键;浏览器侧据此从预取数据中定位并剥除该条目。
|
|
145
|
+
*/
|
|
146
|
+
declare const NAVIGATION_TREE_INTENT_ID = "@finesoft/navigation-tree";
|
|
147
|
+
/** 哨兵条目的 data 形态:序列化后的导航树 + 一个判别标记。 */
|
|
148
|
+
interface SerializedNavigationTreePayload {
|
|
149
|
+
/** 判别标记,配合 `NAVIGATION_TREE_INTENT_ID` 双重确认这是导航哨兵。 */
|
|
150
|
+
readonly __finesoftNavigationTree: true;
|
|
151
|
+
/** 序列化后的导航树(`deserializeNavigation` 可无损还原)。 */
|
|
152
|
+
readonly tree: SerializedNavigation;
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* 应用声明的导航结构(SSR 侧)。
|
|
156
|
+
*
|
|
157
|
+
* - `codec`:把 URL 解析为初始树(带 `__nav` 结构化覆盖时深链还原整棵树)。
|
|
158
|
+
* - `initial`:可选的初始树工厂——codec 无覆盖、且应用想在无深链参数时也展示多区域骨架
|
|
159
|
+
* (如默认两列 split / 默认 tabs)时提供。不提供则回退「URL → 单 LeafNode」(今天的单页)。
|
|
160
|
+
* - `beforeLoad` / `afterLoad`:目标级守卫,由控制器对主目标执行(叠加在全局/路由守卫外)。
|
|
161
|
+
*/
|
|
162
|
+
interface SSRNavigationDefinition {
|
|
163
|
+
/** URL ⇄ 树 的编解码器(调用方在 bootstrap 决定,缺省常用 `createActiveLeafCodec`)。 */
|
|
164
|
+
readonly codec: NavigationCodec;
|
|
165
|
+
/** 可选初始树工厂:codec 无法从 URL 还原结构时,用它产出默认结构骨架。 */
|
|
166
|
+
readonly initial?: (url: string) => NavigationNode | undefined;
|
|
167
|
+
/** 目标级 beforeLoad 守卫。 */
|
|
168
|
+
readonly beforeLoad?: readonly BeforeLoadGuard[];
|
|
169
|
+
/** 目标级 afterLoad 守卫。 */
|
|
170
|
+
readonly afterLoad?: readonly AfterLoadGuard[];
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* 导航 SSR 渲染选项。
|
|
174
|
+
*
|
|
175
|
+
* 在 `ssrRender` 的基础上多了一个必填 `navigation` 字段,承载应用声明的导航结构。
|
|
176
|
+
* 其余字段语义与单页 SSR 完全一致。
|
|
177
|
+
*/
|
|
178
|
+
interface SSRRenderNavigationOptions {
|
|
179
|
+
/** 请求 URL */
|
|
180
|
+
readonly url: string;
|
|
181
|
+
/** Framework 配置(含路由注册等) */
|
|
182
|
+
readonly frameworkConfig: FrameworkConfig;
|
|
183
|
+
/** 注册 controllers 和路由的引导函数 */
|
|
184
|
+
readonly bootstrap: (framework: Framework) => void;
|
|
185
|
+
/** 获取错误页面 */
|
|
186
|
+
readonly getErrorPage: (status: number, message: string) => BasePage;
|
|
187
|
+
/**
|
|
188
|
+
* 应用层渲染函数。
|
|
189
|
+
*
|
|
190
|
+
* 第一个参数是「主目标」页面(激活叶子的解析结果),与单页 SSR 的 `renderApp` 形态兼容;
|
|
191
|
+
* 完整的多区域快照通过第三个参数 `snapshot` 传入,应用可据此渲染 tabs / split 等多区域布局。
|
|
192
|
+
*/
|
|
193
|
+
readonly renderApp: (page: BasePage, framework: Framework, snapshot: NavigationSnapshot) => SSRAppResult | Promise<SSRAppResult>;
|
|
194
|
+
/** 导航定义(codec + 目标级守卫 + 可选初始骨架)。 */
|
|
195
|
+
readonly navigation: SSRNavigationDefinition;
|
|
196
|
+
/** 可选的 SSR 请求上下文(如自定义 fetch) */
|
|
197
|
+
readonly ssrContext?: SSRContext;
|
|
198
|
+
/** 解析请求 locale 的回调(返回 lang + dir 用于 <html> 属性) */
|
|
199
|
+
readonly resolveLocale?: (url: string, request?: Request) => {
|
|
200
|
+
lang: string;
|
|
201
|
+
dir: string;
|
|
202
|
+
} | undefined;
|
|
203
|
+
/** 异步加载当前 locale 的翻译字典 */
|
|
204
|
+
readonly loadMessages?: MessagesLoader;
|
|
205
|
+
}
|
|
206
|
+
/** 导航 SSR 渲染结果(在 `SSRRenderResult` 基础上附带最终导航快照)。 */
|
|
207
|
+
interface SSRRenderNavigationResult {
|
|
208
|
+
html: string;
|
|
209
|
+
head: string;
|
|
210
|
+
css: string;
|
|
211
|
+
/** 每个可见目标一条 `{ intent, data: page }` + 一条导航树哨兵条目。 */
|
|
212
|
+
serverData: PrefetchedIntent[];
|
|
213
|
+
/** 主目标路由的渲染模式(由 Router 返回;多区域树默认 undefined → 服务端按 SSR 处理)。 */
|
|
214
|
+
renderMode?: string;
|
|
215
|
+
/** 中间件要求的重定向(服务端应返回 HTTP 301/302)。 */
|
|
216
|
+
redirect?: {
|
|
217
|
+
url: string;
|
|
218
|
+
status: number;
|
|
219
|
+
};
|
|
220
|
+
/** 自定义 slot 替换。 */
|
|
221
|
+
slots?: Record<string, string>;
|
|
222
|
+
/** 解析出的 locale 属性(用于 <html lang="" dir="">)。 */
|
|
223
|
+
locale?: {
|
|
224
|
+
lang: string;
|
|
225
|
+
dir: string;
|
|
226
|
+
};
|
|
227
|
+
/** 主目标 deny / dispatch 失败时的 HTTP 状态码(服务端据此设置 response status)。 */
|
|
228
|
+
status?: number;
|
|
229
|
+
/** 最终导航快照(树 + 所有可见目标解析结果)。 */
|
|
230
|
+
snapshot: NavigationSnapshot;
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* 渲染一棵结构化导航树的 SSR。
|
|
234
|
+
*
|
|
235
|
+
* 单 LeafNode 树 = 今天的扁平单页:一个可见目标,`serverData` 形如
|
|
236
|
+
* `[{ intent, data: page }, <tree-sentinel>]`——比单页 SSR 仅多一条哨兵。
|
|
237
|
+
*/
|
|
238
|
+
declare function ssrRenderNavigation(options: SSRRenderNavigationOptions): Promise<SSRRenderNavigationResult>;
|
|
239
|
+
/**
|
|
240
|
+
* 从 `serverData`(或 hydration 数组)中取出导航树并反序列化。
|
|
241
|
+
* 找不到哨兵 → undefined(应用未启用导航 / 单页路径)。畸形哨兵数据抛 NavigationError。
|
|
242
|
+
*/
|
|
243
|
+
declare function extractNavigationTree(data: readonly PrefetchedIntent[]): NavigationNode | undefined;
|
|
244
|
+
/**
|
|
245
|
+
* 返回剔除导航树哨兵后的纯目标条目(供 `PrefetchedIntents.fromArray` 还原每个目标)。
|
|
246
|
+
* 无哨兵时内容等价于原数组。
|
|
247
|
+
*/
|
|
248
|
+
declare function stripNavigationTree(data: readonly PrefetchedIntent[]): PrefetchedIntent[];
|
|
249
|
+
/** `createSSRNavigationRender` 的一次性配置(绑定后返回 `(url, ctx?) => result`)。 */
|
|
250
|
+
interface SSRNavigationRenderConfig {
|
|
251
|
+
/** 注册 controllers 和路由的引导函数 */
|
|
252
|
+
readonly bootstrap: (framework: Framework) => void;
|
|
253
|
+
/** 获取错误页面 */
|
|
254
|
+
readonly getErrorPage: (status: number, message: string) => BasePage;
|
|
255
|
+
/** 应用层渲染函数(含多区域快照) */
|
|
256
|
+
readonly renderApp: (page: BasePage, framework: Framework, snapshot: NavigationSnapshot) => SSRAppResult | Promise<SSRAppResult>;
|
|
257
|
+
/** 导航定义(codec + 目标级守卫 + 可选初始骨架) */
|
|
258
|
+
readonly navigation: SSRNavigationDefinition;
|
|
259
|
+
/** Framework 构造配置(可选) */
|
|
260
|
+
readonly frameworkConfig?: FrameworkConfig;
|
|
261
|
+
/** 解析请求 locale 的回调 */
|
|
262
|
+
readonly resolveLocale?: (url: string, request?: Request) => {
|
|
263
|
+
lang: string;
|
|
264
|
+
dir: string;
|
|
265
|
+
} | undefined;
|
|
266
|
+
/** 异步加载当前 locale 的翻译字典 */
|
|
267
|
+
readonly loadMessages?: MessagesLoader;
|
|
268
|
+
}
|
|
269
|
+
/**
|
|
270
|
+
* 创建导航 SSR render 函数。
|
|
271
|
+
*
|
|
272
|
+
* 把一次性配置(bootstrap / getErrorPage / renderApp / navigation)绑定后,返回
|
|
273
|
+
* `(url, ssrContext?) => Promise<SSRRenderNavigationResult>`,与 `createSSRRender` 同形。
|
|
274
|
+
*/
|
|
275
|
+
declare function createSSRNavigationRender(config: SSRNavigationRenderConfig): (url: string, ssrContext?: SSRContext) => Promise<SSRRenderNavigationResult>;
|
|
276
|
+
//#endregion
|
|
139
277
|
//#region ../ssr/src/server-data.d.ts
|
|
140
278
|
interface SerializeServerDataOptions {
|
|
141
279
|
/**
|
|
@@ -548,5 +686,5 @@ declare function finesoftFrontViteConfig(options?: FinesoftFrontViteOptions): {
|
|
|
548
686
|
closeBundle(): Promise<void>;
|
|
549
687
|
};
|
|
550
688
|
//#endregion
|
|
551
|
-
export { ACTION_KINDS, Action, ActionDispatcher, ActionHandler, type ActionHandlerDependencies, type Adapter, type AdapterContext, AfterLoadGuard, AsyncMapper, BASE_PAGE_FIELDS, BaseController, BaseItem, BaseLogger, BasePage, BaseShelf, BeforeLoadGuard, type BrowserAppConfig, BrowserContextOptions, CompositeEventRecorder, CompositeLogger, CompositeLoggerFactory, CompoundAction, ConsoleEventRecorder, ConsoleLogger, ConsoleLoggerFactory, Container, DEP_KEYS, DefineRoutesOptions, DenyResult, EventRecorder, ExternalUrlAction, type ExternalUrlDependencies, ExtractParamNames, FINESOFT_PUBLIC, FeatureFlags, FeatureFlagsProvider, type FinesoftFrontViteOptions, FlowAction, type FlowActionCallbacks, type FlowActionDependencies, Framework, FrameworkConfig, History, HostCheckResult, HostGuardError, HttpClient, HttpClientConfig, HttpError, ImpressionEntry, ImpressionObserver, ImpressionObserverOptions, InferOutput, InferParams, InferQuery, type InjectSSROptions, Intent, IntentController, IntentDispatcher, IntersectionImpressionObserver, LocaleAttributes, LocaleInfo, Logger, Logger as LoggerInterface, LoggerFactory, LruMap, MakeDependenciesOptions, Mapper, MessagesLoader, MessagesLoaderContext, MetricsFieldsProvider, MetricsRecorder, MiddlewareResult, NavigationContext, Net, NextResult, None, NumOptions, Optional, PWADisplayMode, ParamSchema, ParamsFor, PlatformInfo, PluralCategory, PluralRuleProvider, PostLoadContext, PrefetchedIntent, PrefetchedIntents, type ProxyAuthConfig, type ProxyRouteConfig, QuerySchemaMap, RedirectResult, RenderMode, ReportCallback, ReportingLogger, ReportingLoggerFactory, ReportingLoggerOptions, RequestInterceptor, RequestScopedKey, ResponseInterceptor, RewriteResult, RouteAddOptions, RouteDefinition, RouteMatch, Router, type RuntimeInfo, type SSRAppOptions, type SSRContext, type SSRModule, type SSRRenderConfig, type SSRRenderOptions, type SSRRenderResult, SSR_PLACEHOLDERS, SafeErrorPageOptions, SecureFetchOptions, type SerializeServerDataOptions, type ServerConfig, ServerContextOptions, type ServerInstance, SimpleTranslator, SimpleTranslatorOptions, StandardIssue, StandardResult, StandardSchemaV1, type StartServerOptions, Storage, StrOptions, StripOptional, TextDirection, TranslationMessages, Translator, VoidEventRecorder, WithFieldsRecorder, autoAdapter, bool, buildUrl, classifyHost, classifyUrl, cloudflareAdapter, createBrowserContext, createPrefetchedIntentsFromDom, createSSRApp, createSSRRender, createServer, createServerContext, defineRequestScopedKey, defineRoutes, deny, deserializeServerData, detectPlatform, detectRuntime, englishPlural, finesoftFrontViteConfig, generateProxyCode, generateUuid, getBaseUrl, getLocaleAttributes, getPWADisplayMode, getPublicFields, getTextDirection, injectCSRShell, injectSSRContent, int, interpolate, isCompoundAction, isExternalUrlAction, isFlowAction, isNone, isPublicMarked, isRtl, isSome, makeDependencies, makeExternalUrlAction, makeFlowAction, makeLocaleInfo, makeSchema, mapEach, markPublic, netlifyAdapter, next, nodeAdapter, num, oneOf, optional, parseAcceptLanguage, pipe, pipeAsync, redirect, registerActionHandlers, registerExternalUrlHandler, registerFlowActionHandler, registerProxyRoutes, removeHost, removeQueryParams, removeScheme, resetFilterCache, resolveAdapter, resolveConfiguredMessages, resolveLocaleFromUrl, resolveMessages, resolvePluralKey, resolveRoot, rewrite, route, runAfterLoadGuards, runBeforeLoadGuards, runStandard, safeErrorPage, secureFetch, serializeServerData, setHtmlLocaleAttributes, shouldLog, ssrRender, stableStringify, startBrowserApp, startServer, staticAdapter, str, tryScroll, uuid, vercelAdapter, withDefault };
|
|
689
|
+
export { ACTION_KINDS, Action, ActionDispatcher, ActionHandler, type ActionHandlerDependencies, type Adapter, type AdapterContext, AfterLoadGuard, AsyncMapper, BASE_PAGE_FIELDS, BaseController, BaseItem, BaseLogger, BasePage, BaseShelf, BeforeLoadGuard, type BrowserAppConfig, BrowserContextOptions, type BrowserNavigationConfig, CompositeEventRecorder, CompositeLogger, CompositeLoggerFactory, CompoundAction, ConsoleEventRecorder, ConsoleLogger, ConsoleLoggerFactory, Container, DEFAULT_NAV_PARAM, DEP_KEYS, DefineNavigationOptions, DefineRoutesOptions, DenyResult, EventRecorder, ExternalUrlAction, type ExternalUrlDependencies, ExtractParamNames, FINESOFT_PUBLIC, FeatureFlags, FeatureFlagsProvider, type FinesoftFrontViteOptions, FlowAction, type FlowActionCallbacks, type FlowActionDependencies, Framework, FrameworkConfig, FullStateCodecOptions, History, HostCheckResult, HostGuardError, HttpClient, HttpClientConfig, HttpError, HydrateOperation, ImpressionEntry, ImpressionObserver, ImpressionObserverOptions, InferOutput, InferParams, InferQuery, type InjectSSROptions, Intent, IntentController, IntentDispatcher, IntersectionImpressionObserver, LeafNode, LocaleAttributes, LocaleInfo, Logger, Logger as LoggerInterface, LoggerFactory, LruMap, MakeDependenciesOptions, Mapper, MessagesLoader, MessagesLoaderContext, MetricsFieldsProvider, MetricsRecorder, MiddlewareResult, NAVIGATION_NODE_KINDS, NAVIGATION_OP_KINDS, NAVIGATION_TREE_INTENT_ID, type NavigationBridgeDependencies, NavigationBrowserConfig, NavigationCodec, NavigationContext, NavigationContextInput, NavigationController, NavigationControllerOptions, NavigationDefinition, NavigationDispatchContext, NavigationError, type NavigationHandle, NavigationInitial, NavigationNode, NavigationNodeKind, NavigationOpKind, NavigationOperation, NavigationPath, NavigationPathStep, NavigationRouterLike, NavigationSSRDefinition, NavigationSnapshot, Net, NextResult, None, NumOptions, Optional, PWADisplayMode, Page, ParamSchema, ParamsFor, PlatformInfo, PluralCategory, PluralRuleProvider, PopOperation, PopToOperation, PopToRootOperation, PostLoadContext, PrefetchedIntent, PrefetchedIntents, type ProxyAuthConfig, type ProxyRouteConfig, PushOperation, PushOptions, QuerySchemaMap, RedirectResult, RenderMode, ReplaceTopOperation, ReportCallback, ReportingLogger, ReportingLoggerFactory, ReportingLoggerOptions, RequestInterceptor, RequestScopedKey, ResolvedDestination, ResponseInterceptor, RewriteResult, RouteAddOptions, RouteDefinition, RouteMatch, RouteParams, Router, type RuntimeInfo, SPLIT_VISIBILITIES, type SSRAppOptions, type SSRContext, type SSRModule, type SSRNavigationDefinition, type SSRNavigationRenderConfig, type SSRRenderConfig, type SSRRenderNavigationOptions, type SSRRenderNavigationResult, type SSRRenderOptions, type SSRRenderResult, SSR_PLACEHOLDERS, SafeErrorPageOptions, SecureFetchOptions, SelectColumnOperation, SelectTabOperation, type SerializeServerDataOptions, SerializedLeaf, SerializedNavigation, type SerializedNavigationTreePayload, SerializedSplit, SerializedSplitColumn, SerializedStack, SerializedTabs, type ServerConfig, ServerContextOptions, type ServerInstance, SetVisibilityOperation, SimpleTranslator, SimpleTranslatorOptions, SplitColumn, SplitColumnInit, SplitNode, SplitVisibility, StackNode, StandardIssue, StandardResult, StandardSchemaV1, type StartServerOptions, Storage, StrOptions, StripOptional, TabsInit, TabsNode, TextDirection, TranslationMessages, Translator, VoidEventRecorder, WithFieldsRecorder, autoAdapter, bool, buildUrl, classifyHost, classifyUrl, cloudflareAdapter, collectVisibleDestinations, createActiveLeafCodec, createBrowserContext, createFullStateCodec, createNavigationBridge, createNavigationController, createPrefetchedIntentsFromDom, createSSRApp, createSSRNavigationRender, createSSRRender, createServer, createServerContext, decodeNavigationTreeParam, defineNavigation, defineRequestScopedKey, defineRoutes, deny, deserializeNavigation, deserializeServerData, detectPlatform, detectRuntime, encodeNavigationTreeParam, englishPlural, extractNavigationTree, findNearestStack, findNode, finesoftFrontViteConfig, generateProxyCode, generateUuid, getBaseUrl, getLocaleAttributes, getPWADisplayMode, getPublicFields, getTextDirection, injectCSRShell, injectSSRContent, int, interpolate, isCompoundAction, isExternalUrlAction, isFlowAction, isLeafNode, isNone, isPublicMarked, isRtl, isSome, isSplitNode, isStackNode, isTabsNode, leaf, makeDependencies, makeExternalUrlAction, makeFlowAction, makeLocaleInfo, makeSchema, mapEach, markPublic, netlifyAdapter, next, nodeAdapter, num, oneOf, optional, parseAcceptLanguage, pipe, pipeAsync, pop, popTo, popToRoot, push, redirect, registerActionHandlers, registerExternalUrlHandler, registerFlowActionHandler, registerProxyRoutes, removeHost, removeQueryParams, removeScheme, replaceTop, resetFilterCache, resolveActivePath, resolveAdapter, resolveConfiguredMessages, resolveLocaleFromUrl, resolveMessages, resolvePluralKey, resolveRoot, rewrite, route, runAfterLoadGuards, runBeforeLoadGuards, runStandard, safeErrorPage, secureFetch, selectColumn, selectTab, serializeNavigation, serializeNavigationStable, serializeServerData, setHtmlLocaleAttributes, setVisibility, shouldLog, split, ssrRender, ssrRenderNavigation, stableStringify, stack, startBrowserApp, startServer, staticAdapter, str, stripNavigationTree, tabs, tryScroll, uuid, vercelAdapter, visibleSplitColumns, withDefault };
|
|
552
690
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{$ as e,A as t,At as n,B as r,Bt as i,C as a,Ct as o,D as s,Dt as c,E as l,Et as u,F as d,Ft as f,G as p,H as m,Ht as h,I as g,It as _,J as v,K as y,L as b,Lt as x,M as S,Mt as C,N as ee,Nt as w,O as T,Ot as E,P as D,Pt as te,Q as ne,R as re,Rt as ie,S as ae,St as oe,T as se,Tt as ce,U as le,Ut as ue,V as de,Vt as fe,W as pe,X as me,Y as he,Z as ge,_ as _e,_t as ve,a as ye,at as be,b as xe,bt as Se,c as Ce,ct as we,d as Te,dt as Ee,et as De,f as Oe,ft as ke,g as Ae,gt as je,h as Me,ht as Ne,i as Pe,it as O,j as Fe,jt as Ie,k as Le,kt as Re,l as ze,lt as Be,m as Ve,mt as He,n as Ue,nt as We,o as Ge,ot as Ke,p as qe,pt as Je,q as Ye,r as Xe,rt as Ze,s as Qe,st as $e,t as et,tt,u as nt,ut as rt,v as k,vt as it,w as at,wt as ot,x as st,xt as A,y as ct,yt as lt,z as ut,zt as dt}from"./start-app-S4DH-40i.mjs";import{Hono as j}from"hono";async function M(e){return N(e,0)}async function N(e,t){if(t>=5)throw Error(`[SSR] Rewrite recursion depth exceeded (max 5) at "${e.url}"`);let{url:n,frameworkConfig:r,bootstrap:i,getErrorPage:a,renderApp:o,ssrContext:s,resolveLocale:c,loadMessages:l}=e,u=new URL(n,`http://localhost`),d=u.pathname+u.search,f=c?.(n,s?.request),p=f?{...r,locale:f.lang}:r,m=await A({locale:p.locale,loadMessages:l,context:p.locale?{runtime:`server`,fetch:ft(s?.fetch??p.fetch),url:d,request:s?.request}:void 0}),h={...p,fetch:s?.fetch??p.fetch},g=de.create({...h,_resolvedMessages:m});i(g);try{let n=await g.routeUrl(d);if(n?.renderMode===`csr`)return{html:``,head:``,css:``,serverData:[],renderMode:`csr`};let r,i=[],c;if(n){let l=k({url:d,intent:n.intent,container:g.container,request:s?.request}),u=await g.runBeforeLoad(l,n.beforeGuards);if(u.kind===`rewrite`)return N({...e,url:u.url},t+1);if(u.kind!==`next`){let e=await P(u,a,o,g);if(e)return e}try{r=await g.dispatch(n.intent),i=[{intent:n.intent,data:r}]}catch(e){g.container.resolve(O.LOGGER).error(`[SSR] dispatch failed for intent "${n.intent.id}":`,e),r=a(500,`Internal error`)}let f={...l,page:r},p=await g.runAfterLoad(f,n.afterGuards);if(p.kind===`rewrite`)c=p.url;else if(p.kind!==`next`){let e=await P(p,a,o,g);if(e)return e}}else r=a(404,`Page not found`);let l=await o(r,g),u=f??g.getLocale();return{html:l.html,head:l.head,css:l.css,serverData:i,renderMode:n?.renderMode,slots:l.slots,locale:u,rewriteUrl:c}}finally{g.dispose()}}function ft(e){return(e??globalThis.fetch?.bind(globalThis))||(()=>{throw Error(`[ssrRender] loadMessages requires a fetch implementation.`)})}async function P(e,t,n,r){switch(e.kind){case`next`:case`rewrite`:return null;case`redirect`:return{html:``,head:``,css:``,serverData:[],redirect:{url:e.url,status:e.status}};case`deny`:{let i=await n(t(e.status,e.message),r);return{html:i.html,head:i.head,css:i.css,serverData:[],slots:i.slots,status:e.status}}}}function pt(e){let{bootstrap:t,getErrorPage:n,renderApp:r,frameworkConfig:i,resolveLocale:a,loadMessages:o}=e;return(e,s)=>M({url:e,frameworkConfig:i??{},bootstrap:t,getErrorPage:n,renderApp:(e,t)=>r(e,t),ssrContext:s,resolveLocale:a,loadMessages:o})}const mt={HEAD:`<!--ssr-head-->`,BODY:`<!--ssr-body-->`,DATA:`<!--ssr-data-->`},F=/<!--ssr-([a-z][a-z0-9-]*)-->/g;function I(e){let{template:t,head:n,css:r,html:i,serializedData:a,slots:o,locale:s}=e,c={head:`${n}\n${r?`<style>${r}</style>`:``}`,body:i,data:`<script id="serialized-server-data" type="application/json">${a}<\/script>`,...o},l=t.replace(F,(e,t)=>c[t]??``);return s&&(l=R(l,s)),l}function L(e,t){let n=e.replace(F,()=>``);return t&&(n=R(n,t)),n}const ht=/\s+lang=("[^"]*"|'[^']*'|[^\s>]+)/gi,gt=/\s+dir=("[^"]*"|'[^']*'|[^\s>]+)/gi;function R(e,t){return e.replace(/(<html)([^>]*)(>)/i,(e,n,r,i)=>`${n}${r.replace(ht,``).replace(gt,``)} lang="${t.lang}" dir="${t.dir}"${i}`)}const _t={"<":`\\u003C`,">":`\\u003E`,"/":`\\u002F`,"\u2028":`\\u2028`,"\u2029":`\\u2029`},vt=RegExp(`[<>/\\u2028\\u2029]`,`g`);let z=!1;function yt(e,t={}){let n=t.onUnmarkedPage??`all`,r=e.map(e=>bt(e,n));return JSON.stringify(r).replace(vt,e=>_t[e]??e)}function bt(e,t){let n=e.data,r=re(n);if(r===!0)return e;if(Array.isArray(r))return{...e,data:B(n,r)};if(t===`strict`)throw Error(`[serializeServerData] page for intent "${e.intent.id}" has no markPublic marker; wrap it with markPublic(page, ["field", ...]) to declare client-visible fields.`);return t===`base-fields`?{...e,data:B(n,g)}:(xt(e.intent.id),e)}function B(e,t){let n={};for(let r of t)r in e&&(n[r]=e[r]);return n}function xt(e){z||(z=!0,St()&&console.warn(`[finesoft/ssr] Page for intent "${e}" was serialized without markPublic(); all fields (including any sensitive data) are exposed in the SSR HTML. Wrap your page with markPublic(page, ["field", ...]) to declare client-visible fields explicitly. The next major version will default to BasePage-only fields when no marker is present.`))}function St(){try{return globalThis.process?.env?.NODE_ENV!==`production`}catch{return!1}}const V=new Map,Ct=e=>import(e),wt=typeof process<`u`&&process.env?.FINESOFT_DEBUG===`1`;function Tt(e){wt&&console.debug(`[finesoft:dynamic-import] ${e}`)}async function H(e){let t=!e.startsWith(`file:`)&&!e.startsWith(`/`);if(t){let t=V.get(e);if(t)return Tt(`cache hit → ${e}`),t}Tt(`importing → ${e}`);let n=await Ct(e);return t&&V.set(e,n),n}const U=10*1024*1024;function Et(e){if(e.length>2048)return null;try{if(decodeURIComponent(e)!==e)return null}catch{return null}return e.startsWith(`//`)||!/^[/\w.\-~%:@!$&'()*+,;=]*$/.test(e)?null:e.startsWith(`/`)?e:`/${e}`}function Dt(e){if(!e.prefix.startsWith(`/`))throw Error(`[proxy] prefix must start with "/": "${e.prefix}"`);let t=e.target.startsWith(`https://`),n=e.target.startsWith(`http://`);if(!t&&!n)throw Error(`[proxy] target must start with "https://" or "http://": "${e.target}"`);n&&console.warn(`[proxy] ⚠ target "${e.target}" uses plain HTTP — traffic will not be encrypted. Use HTTPS in production to prevent data interception.`)}function W(e,t){for(let n of t){Dt(n);let t=n.methods??[`all`],r=`${n.prefix}/*`,i=async e=>{let t=Et(e.req.path.replace(n.prefix,``));if(!t)return e.text(`Invalid path`,400);let r=new URL(t,n.target),i=new URL(n.target).origin;if(r.origin!==i)return e.text(`Invalid proxy target`,400);new URL(e.req.url).searchParams.forEach((e,t)=>r.searchParams.set(t,e));let a={...n.headers};if(n.auth){let e=process.env[n.auth.envKey];e?a.Authorization=n.auth.type===`bearer`?`Bearer ${e}`:`Basic ${e}`:console.warn(`[Proxy ${n.prefix}] Auth env var "${n.auth.envKey}" is not set`)}try{let t=await fetch(r.toString(),{headers:a,redirect:n.followRedirects?`follow`:`manual`}),i=t.headers.get(`Content-Length`);if(i&&parseInt(i,10)>U)return e.text(`Proxy response too large`,502);let o=await t.arrayBuffer();if(o.byteLength>U)return e.text(`Proxy response too large`,502);let s={"Content-Type":t.headers.get(`Content-Type`)??`application/json`};return n.cache&&(s[`Cache-Control`]=n.cache),e.newResponse(o,t.status,s)}catch(t){return console.error(`[Proxy ${n.prefix}]`,t),e.json({error:`Proxy request failed`},502)}};for(let n of t)e[n](r,i)}}function Ot(e){if(!e||e.length===0)return``;for(let t of e)Dt(t);let t=[];t.push(`
|
|
1
|
+
import{$ as e,$t as t,A as n,At as r,B as i,Bt as a,C as o,Cn as s,Ct as c,D as l,Dt as u,E as d,Et as f,F as p,Ft as m,G as h,Gt as g,H as _,Ht as v,I as y,It as b,J as x,Jt as S,K as ee,Kt as C,L as w,Lt as T,M as E,Mt as te,N as ne,Nt as re,O as ie,Ot as ae,P as D,Pt as oe,Q as se,Qt as ce,R as le,Rt as ue,S as de,Sn as fe,St as O,T as pe,Tn as me,Tt as he,U as ge,Ut as _e,V as ve,Vt as ye,W as be,Wt as xe,X as Se,Xt as Ce,Y as we,Yt as Te,Z as Ee,Zt as De,_ as Oe,_n as ke,_t as Ae,a as je,an as k,at as Me,b as Ne,bn as Pe,bt as A,c as Fe,cn as Ie,ct as Le,d as Re,dn as ze,dt as Be,en as Ve,et as He,f as Ue,fn as We,ft as Ge,g as Ke,gn as qe,gt as Je,h as Ye,hn as Xe,ht as Ze,i as Qe,in as $e,it as et,j as tt,jt as nt,k as j,kt as rt,l as it,ln as at,lt as ot,m as st,mn as ct,mt as lt,n as ut,nn as dt,nt as ft,o as pt,on as mt,ot as M,p as ht,pn as gt,pt as _t,q as vt,qt as yt,r as bt,rn as N,rt as xt,s as St,sn as Ct,st as wt,t as Tt,tn as Et,tt as Dt,u as Ot,un as kt,ut as At,v as jt,vn as Mt,vt as P,w as Nt,wn as Pt,wt as Ft,x as It,xn as Lt,xt as Rt,y as F,yn as zt,yt as Bt,z as Vt,zt as Ht}from"./src-BI4eMjHk.mjs";import{Hono as I}from"hono";async function L(e){return Ut(e,0)}async function Ut(e,t){if(t>=5)throw Error(`[SSR] Rewrite recursion depth exceeded (max 5) at "${e.url}"`);let{url:n,frameworkConfig:r,bootstrap:i,getErrorPage:o,renderApp:s,ssrContext:l,resolveLocale:u,loadMessages:d}=e,f=new URL(n,`http://localhost`),p=f.pathname+f.search,m=u?.(n,l?.request),h=m?{...r,locale:m.lang}:r,g=await N({locale:h.locale,loadMessages:d,context:h.locale?{runtime:`server`,fetch:Wt(l?.fetch??h.fetch),url:p,request:l?.request}:void 0}),_={...h,fetch:l?.fetch??h.fetch},v=c.create({..._,_resolvedMessages:g});i(v);try{let n=await v.routeUrl(p);if(n?.renderMode===`csr`)return{html:``,head:``,css:``,serverData:[],renderMode:`csr`};let r,i=[],c;if(n){let u=F({url:p,intent:n.intent,container:v.container,request:l?.request}),d=await v.runBeforeLoad(u,n.beforeGuards);if(d.kind===`rewrite`)return Ut({...e,url:d.url},t+1);if(d.kind!==`next`){let e=await R(d,o,s,v);if(e)return e}try{r=await v.dispatch(n.intent),i=[{intent:n.intent,data:r}]}catch(e){v.container.resolve(a.LOGGER).error(`[SSR] dispatch failed for intent "${n.intent.id}":`,e),r=o(500,`Internal error`)}let f={...u,page:r},m=await v.runAfterLoad(f,n.afterGuards);if(m.kind===`rewrite`)c=m.url;else if(m.kind!==`next`){let e=await R(m,o,s,v);if(e)return e}}else r=o(404,`Page not found`);let u=await s(r,v),d=m??v.getLocale();return{html:u.html,head:u.head,css:u.css,serverData:i,renderMode:n?.renderMode,slots:u.slots,locale:d,rewriteUrl:c}}finally{v.dispose()}}function Wt(e){return(e??globalThis.fetch?.bind(globalThis))||(()=>{throw Error(`[ssrRender] loadMessages requires a fetch implementation.`)})}async function R(e,t,n,r){switch(e.kind){case`next`:case`rewrite`:return null;case`redirect`:return{html:``,head:``,css:``,serverData:[],redirect:{url:e.url,status:e.status}};case`deny`:{let i=await n(t(e.status,e.message),r);return{html:i.html,head:i.head,css:i.css,serverData:[],slots:i.slots,status:e.status}}}}function Gt(e){let{bootstrap:t,getErrorPage:n,renderApp:r,frameworkConfig:i,resolveLocale:a,loadMessages:o}=e;return(e,s)=>L({url:e,frameworkConfig:i??{},bootstrap:t,getErrorPage:n,renderApp:(e,t)=>r(e,t),ssrContext:s,resolveLocale:a,loadMessages:o})}const Kt={HEAD:`<!--ssr-head-->`,BODY:`<!--ssr-body-->`,DATA:`<!--ssr-data-->`},z=/<!--ssr-([a-z][a-z0-9-]*)-->/g;function B(e){let{template:t,head:n,css:r,html:i,serializedData:a,slots:o,locale:s}=e,c={head:`${n}\n${r?`<style>${r}</style>`:``}`,body:i,data:`<script id="serialized-server-data" type="application/json">${a}<\/script>`,...o},l=t.replace(z,(e,t)=>c[t]??``);return s&&(l=Yt(l,s)),l}function V(e,t){let n=e.replace(z,()=>``);return t&&(n=Yt(n,t)),n}const qt=/\s+lang=("[^"]*"|'[^']*'|[^\s>]+)/gi,Jt=/\s+dir=("[^"]*"|'[^']*'|[^\s>]+)/gi;function Yt(e,t){return e.replace(/(<html)([^>]*)(>)/i,(e,n,r,i)=>`${n}${r.replace(qt,``).replace(Jt,``)} lang="${t.lang}" dir="${t.dir}"${i}`)}const Xt=`@finesoft/navigation-tree`;async function Zt(e){let{url:t,frameworkConfig:n,bootstrap:r,getErrorPage:i,renderApp:a,navigation:o,ssrContext:s,resolveLocale:l,loadMessages:u}=e,d=new URL(t,`http://localhost`),f=d.pathname+d.search,p=l?.(t,s?.request),m=p?{...n,locale:p.lang}:n,h=await N({locale:m.locale,loadMessages:u,context:m.locale?{runtime:`server`,fetch:un(s?.fetch??m.fetch),url:f,request:s?.request}:void 0}),g={...m,fetch:s?.fetch??m.fetch},_=c.create({...g,_resolvedMessages:h});r(_);try{let e=await Qt(_,o,f);if(e===void 0)return ln({framework:_,resolvedLocale:p,renderApp:a,page:i(404,`Page not found`),snapshot:{tree:M(`@finesoft/not-found`),destinations:[]},serverData:[],renderMode:void 0,status:void 0});let{tree:t,renderMode:n}=e;if(n===`csr`)return{html:``,head:``,css:``,serverData:[],renderMode:`csr`,snapshot:{tree:t,destinations:[]}};let r,c=await $t({framework:_,navigation:o,initialTree:t,fullPath:f,request:s?.request,getErrorPage:i,onRedirect:e=>{r??=e}}).resolve();if(r!==void 0)return{html:``,head:``,css:``,serverData:[],redirect:r,snapshot:c};let l=en(c,i);return ln({framework:_,resolvedLocale:p,renderApp:a,page:l.page,snapshot:c,serverData:rn(c),renderMode:n,status:l.status})}finally{_.dispose()}}async function Qt(e,t,n){let r=t.codec.decode(n,e.router);if(r!==void 0)return{tree:r,renderMode:void 0};let i=t.initial?.(n);if(i!==void 0)return{tree:i,renderMode:void 0};let a=await e.routeUrl(n);if(a!==null)return{tree:M(a.intent.id,a.intent.params??{}),renderMode:a.renderMode}}function $t(e){let{framework:t,navigation:n,initialTree:r,fullPath:i,request:a,getErrorPage:o,onRedirect:s}=e;return D({intentDispatcher:t.intentDispatcher,router:t.router,initial:r,beforeLoad:n.beforeLoad,afterLoad:n.afterLoad,getErrorPage:o,onRedirect:s,createContext:({intent:e,params:n})=>({container:t.container,url:i,navigation:F({url:i,intent:{id:e,params:n},container:t.container,request:a})})})}function en(e,t){let n=tn(e.tree);if(n!==void 0){let t=e.destinations.find(e=>e.intent===n.intent&&nn(e.params,n.params));if(t!==void 0)return t}return e.destinations.length>0?e.destinations[0]:{intent:`@finesoft/empty`,params:{},page:t(404,`Page not found`),status:404}}function tn(e){let t=e;for(;;)switch(t.kind){case`leaf`:return{intent:t.intent,params:t.params};case`stack`:if(t.entries.length===0)return;t=t.entries[t.entries.length-1];break;case`tabs`:{let e=t.branches[t.active];if(e===void 0)return;t=e;break}case`split`:{let e;for(let n of t.columns)n.content!==void 0&&(e=n.content);if(e===void 0)return;t=e;break}}}function nn(e,t){let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r of n)if(e[r]!==t[r])return!1;return!0}function rn(e){let t=[];for(let n of e.destinations)t.push({intent:{id:n.intent,params:n.params},data:n.page});return t.push(an(e.tree)),t}function an(e){let t={__finesoftNavigationTree:!0,tree:ve(e)};return{intent:{id:Xt},data:O(t,!0)}}function on(e){for(let t of e)if(cn(t))return i(t.data.tree)}function sn(e){return e.filter(e=>!cn(e))}function cn(e){if(e.intent.id!==`@finesoft/navigation-tree`)return!1;let t=e.data;return typeof t==`object`&&!!t&&t.__finesoftNavigationTree===!0}async function ln(e){let{framework:t,resolvedLocale:n,renderApp:r,page:i,snapshot:a,serverData:o,renderMode:s,status:c}=e,l=await r(i,t,a),u=n??t.getLocale();return{html:l.html,head:l.head,css:l.css,serverData:o,renderMode:s,slots:l.slots,locale:u,status:c,snapshot:a}}function un(e){return(e??globalThis.fetch?.bind(globalThis))||(()=>{throw Error(`[ssrRenderNavigation] loadMessages requires a fetch implementation.`)})}function dn(e){let{bootstrap:t,getErrorPage:n,renderApp:r,navigation:i,frameworkConfig:a,resolveLocale:o,loadMessages:s}=e;return(e,c)=>Zt({url:e,frameworkConfig:a??{},bootstrap:t,getErrorPage:n,renderApp:r,navigation:i,ssrContext:c,resolveLocale:o,loadMessages:s})}const fn={"<":`\\u003C`,">":`\\u003E`,"/":`\\u002F`,"\u2028":`\\u2028`,"\u2029":`\\u2029`},pn=RegExp(`[<>/\\u2028\\u2029]`,`g`);let mn=!1;function hn(e,t={}){let n=t.onUnmarkedPage??`all`,r=e.map(e=>gn(e,n));return JSON.stringify(r).replace(pn,e=>fn[e]??e)}function gn(e,t){let n=e.data,r=A(n);if(r===!0)return e;if(Array.isArray(r))return{...e,data:_n(n,r)};if(t===`strict`)throw Error(`[serializeServerData] page for intent "${e.intent.id}" has no markPublic marker; wrap it with markPublic(page, ["field", ...]) to declare client-visible fields.`);return t===`base-fields`?{...e,data:_n(n,P)}:(vn(e.intent.id),e)}function _n(e,t){let n={};for(let r of t)r in e&&(n[r]=e[r]);return n}function vn(e){mn||(mn=!0,yn()&&console.warn(`[finesoft/ssr] Page for intent "${e}" was serialized without markPublic(); all fields (including any sensitive data) are exposed in the SSR HTML. Wrap your page with markPublic(page, ["field", ...]) to declare client-visible fields explicitly. The next major version will default to BasePage-only fields when no marker is present.`))}function yn(){try{return globalThis.process?.env?.NODE_ENV!==`production`}catch{return!1}}const bn=new Map,xn=e=>import(e),Sn=typeof process<`u`&&process.env?.FINESOFT_DEBUG===`1`;function Cn(e){Sn&&console.debug(`[finesoft:dynamic-import] ${e}`)}async function H(e){let t=!e.startsWith(`file:`)&&!e.startsWith(`/`);if(t){let t=bn.get(e);if(t)return Cn(`cache hit → ${e}`),t}Cn(`importing → ${e}`);let n=await xn(e);return t&&bn.set(e,n),n}const U=10*1024*1024;function wn(e){if(e.length>2048)return null;try{if(decodeURIComponent(e)!==e)return null}catch{return null}return e.startsWith(`//`)||!/^[/\w.\-~%:@!$&'()*+,;=]*$/.test(e)?null:e.startsWith(`/`)?e:`/${e}`}function Tn(e){if(!e.prefix.startsWith(`/`))throw Error(`[proxy] prefix must start with "/": "${e.prefix}"`);let t=e.target.startsWith(`https://`),n=e.target.startsWith(`http://`);if(!t&&!n)throw Error(`[proxy] target must start with "https://" or "http://": "${e.target}"`);n&&console.warn(`[proxy] ⚠ target "${e.target}" uses plain HTTP — traffic will not be encrypted. Use HTTPS in production to prevent data interception.`)}function W(e,t){for(let n of t){Tn(n);let t=n.methods??[`all`],r=`${n.prefix}/*`,i=async e=>{let t=wn(e.req.path.replace(n.prefix,``));if(!t)return e.text(`Invalid path`,400);let r=new URL(t,n.target),i=new URL(n.target).origin;if(r.origin!==i)return e.text(`Invalid proxy target`,400);new URL(e.req.url).searchParams.forEach((e,t)=>r.searchParams.set(t,e));let a={...n.headers};if(n.auth){let e=process.env[n.auth.envKey];e?a.Authorization=n.auth.type===`bearer`?`Bearer ${e}`:`Basic ${e}`:console.warn(`[Proxy ${n.prefix}] Auth env var "${n.auth.envKey}" is not set`)}try{let t=await fetch(r.toString(),{headers:a,redirect:n.followRedirects?`follow`:`manual`}),i=t.headers.get(`Content-Length`);if(i&&parseInt(i,10)>U)return e.text(`Proxy response too large`,502);let o=await t.arrayBuffer();if(o.byteLength>U)return e.text(`Proxy response too large`,502);let s={"Content-Type":t.headers.get(`Content-Type`)??`application/json`};return n.cache&&(s[`Cache-Control`]=n.cache),e.newResponse(o,t.status,s)}catch(t){return console.error(`[Proxy ${n.prefix}]`,t),e.json({error:`Proxy request failed`},502)}};for(let n of t)e[n](r,i)}}function En(e){if(!e||e.length===0)return``;for(let t of e)Tn(t);let t=[];t.push(`
|
|
2
2
|
// ─── 框架声明式代理路由 ───
|
|
3
3
|
function _sanitizeProxyPath(raw) {
|
|
4
4
|
if (raw.length > 2048) return null;
|
|
@@ -37,7 +37,7 @@ function _sanitizeProxyPath(raw) {
|
|
|
37
37
|
return c.json({ error: "Proxy request failed" }, 502);
|
|
38
38
|
}
|
|
39
39
|
}`;for(let n of e)t.push(`app.${n}(${r}, ${c});`)}return t.join(`
|
|
40
|
-
`)}const
|
|
40
|
+
`)}const Dn=[`vite`,`esbuild`,`rollup`,`fsevents`,`lightningcss`],On=[`node:async_hooks`,`node:buffer`,`node:crypto`,`node:fs`,`node:http`,`node:http2`,`node:module`,`node:net`,`node:os`,`node:path`,`node:stream`,`node:url`,`node:util`,`node:zlib`,`crypto`,`http`,`http2`,`stream`];function G(e,t){let n=e.setupPath?`import _setupDefault from "./${e.setupPath}";`:``,r=e.setupPath?`if (typeof _setupDefault === "function") await _setupDefault(app);`:``,i=JSON.stringify(e.renderModes??{}),a=t.platformCache?t.platformCache:`
|
|
41
41
|
const ISR_CACHE_MAX = 1000;
|
|
42
42
|
const _isrMap = new Map();
|
|
43
43
|
async function platformCacheGet(url) {
|
|
@@ -109,7 +109,7 @@ function matchRenderMode(url) {
|
|
|
109
109
|
}
|
|
110
110
|
|
|
111
111
|
const app = new Hono();
|
|
112
|
-
${
|
|
112
|
+
${En(e.proxies??[])}
|
|
113
113
|
${r}
|
|
114
114
|
${t.platformMiddleware??``}
|
|
115
115
|
|
|
@@ -173,8 +173,8 @@ app.get("*", async (c) => {
|
|
|
173
173
|
});
|
|
174
174
|
|
|
175
175
|
${t.platformExport}
|
|
176
|
-
`}async function K(e,t){await e.vite.build({root:e.root,build:{ssr:t.entry,outDir:t.outDir,emptyOutDir:t.emptyOutDir??!0,target:t.target??`node18`,rollupOptions:{output:{entryFileNames:t.fileName??`index.mjs`}}},ssr:{noExternal:t.noExternal!==!1,external:[...t.external??
|
|
177
|
-
<style>`+i+`</style>`,body:n,data:`<script id="serialized-server-data" type="application/json">`+s+`<\/script>`})[t]??``);if(o){let{getLocaleAttributes:e}=await H(`@finesoft/core`),t=e(o);c=c.replace(/<html([^>]*)>/i,(e,n)=>`<html${n.replace(/\s+lang=("[^"]*"|'[^']*'|[^\s>]+)/gi,``).replace(/\s+dir=("[^"]*"|'[^']*'|[^\s>]+)/gi,``)} lang="${t.lang}" dir="${t.dir}">`)}d.push({url:t,html:c})}catch(e){console.warn(` [prerender] Failed to render ${t}:`,e)}return d.length>0&&console.log(` Pre-rendered ${d.length} pages (${c.size} routes)\n`),d}function
|
|
176
|
+
`}async function K(e,t){await e.vite.build({root:e.root,build:{ssr:t.entry,outDir:t.outDir,emptyOutDir:t.emptyOutDir??!0,target:t.target??`node18`,rollupOptions:{output:{entryFileNames:t.fileName??`index.mjs`}}},ssr:{noExternal:t.noExternal!==!1,external:[...t.external??Dn,...On]},resolve:e.resolvedResolve,css:e.resolvedCss})}function q(e,t,n){let{fs:r,path:i}=e;r.cpSync(i.resolve(e.root,`dist/client`),t,{recursive:!0}),n?.excludeHtml!==!1&&r.rmSync(i.join(t,`index.html`),{force:!0})}async function J(e){let{fs:t,path:n,root:r,vite:i}=e,{pathToFileURL:a}=await H(`node:url`),o=e.bootstrapEntry??`src/lib/bootstrap.ts`,s=[];if(t.existsSync(n.resolve(r,o))){await i.build({root:r,build:{ssr:o,outDir:n.resolve(r,`dist/server`),emptyOutDir:!1,rollupOptions:{output:{entryFileNames:`_routes_prerender.mjs`}}},resolve:e.resolvedResolve});let c=a(n.resolve(r,`dist/server/_routes_prerender.mjs`)).href,l=await H(c);s=l.routes??l.default??[],t.rmSync(n.resolve(r,`dist/server/_routes_prerender.mjs`),{force:!0})}let c=new Set;for(let e of s)e.renderMode===`prerender`&&e.path&&!e.path.includes(`:`)&&c.add(e.path);if(e.renderModes)for(let[t,n]of Object.entries(e.renderModes))n===`prerender`&&!t.includes(`*`)&&!t.includes(`:`)&&c.add(t);if(e.locales?.length){let t=[...c];for(let n of e.locales)for(let e of t){let t=e===`/`?`/${n}`:`/${n}${e}`;c.add(t)}}if(c.size===0)return[];let l=a(n.resolve(r,`dist/server/ssr.js`)).href,u=await H(l),d=[];for(let t of c)try{let{html:n,head:r,css:i,serverData:a,locale:o}=await u.render(t),s=u.serializeServerData(a),c=e.templateHtml.replace(/<!--ssr-([a-z][a-z0-9-]*)-->/g,(e,t)=>({head:r+`
|
|
177
|
+
<style>`+i+`</style>`,body:n,data:`<script id="serialized-server-data" type="application/json">`+s+`<\/script>`})[t]??``);if(o){let{getLocaleAttributes:e}=await H(`@finesoft/core`),t=e(o);c=c.replace(/<html([^>]*)>/i,(e,n)=>`<html${n.replace(/\s+lang=("[^"]*"|'[^']*'|[^\s>]+)/gi,``).replace(/\s+dir=("[^"]*"|'[^']*'|[^\s>]+)/gi,``)} lang="${t.lang}" dir="${t.dir}">`)}d.push({url:t,html:c})}catch(e){console.warn(` [prerender] Failed to render ${t}:`,e)}return d.length>0&&console.log(` Pre-rendered ${d.length} pages (${c.size} routes)\n`),d}function kn(){return{name:`cloudflare`,async build(e){let{fs:t,path:n,root:r}=e,i=n.resolve(r,`dist/cloudflare`);t.rmSync(i,{recursive:!0,force:!0});let a=G(e,{platformImport:``,platformExport:`export default app;`,platformCache:`
|
|
178
178
|
const ISR_CACHE_TTL = 3600; // 1 hour
|
|
179
179
|
async function platformCacheGet(url) {
|
|
180
180
|
try {
|
|
@@ -195,7 +195,7 @@ async function platformCacheSet(url, html) {
|
|
|
195
195
|
await cache.put(cacheKey, resp);
|
|
196
196
|
} catch {}
|
|
197
197
|
}`}),o=n.resolve(r,`.cf-entry.tmp.mjs`);t.writeFileSync(o,a);try{await K(e,{entry:`.cf-entry.tmp.mjs`,outDir:i,target:`es2022`,fileName:`_worker.js`}),q(e,n.resolve(i,`assets`));let r=await J(e);for(let{url:e,html:a}of r){let r=e===`/`?n.join(i,`assets`,`index.html`):n.join(i,`assets`,e,`index.html`);t.mkdirSync(n.resolve(r,`..`),{recursive:!0}),t.writeFileSync(r,a)}}finally{t.rmSync(o,{force:!0})}console.log(` Cloudflare output → dist/cloudflare/
|
|
198
|
-
`)}}}function
|
|
198
|
+
`)}}}function An(){return{name:`netlify`,async build(e){let{fs:t,path:n,root:r}=e,i=n.resolve(r,`.netlify/functions-internal/ssr`);t.rmSync(n.resolve(r,`.netlify`),{recursive:!0,force:!0});let a=G(e,{platformImport:`import { handle } from "hono/netlify";`,platformExport:`export default handle(app);
|
|
199
199
|
export const config = { path: "/*", preferStatic: true };`,platformCache:`
|
|
200
200
|
const ISR_SWR_TTL = 3600;
|
|
201
201
|
const ISR_CACHE_MAX = 1000;
|
|
@@ -213,7 +213,7 @@ async function platformCacheSet(url, html) {
|
|
|
213
213
|
c.header("Netlify-CDN-Cache-Control", "public, max-age=" + ISR_SWR_TTL + ", stale-while-revalidate=" + ISR_SWR_TTL + ", durable");`}),o=n.resolve(r,`.netlify-entry.tmp.mjs`);t.writeFileSync(o,a);try{await K(e,{entry:`.netlify-entry.tmp.mjs`,outDir:i,target:`node18`})}finally{t.rmSync(o,{force:!0})}t.writeFileSync(n.resolve(r,`dist/client/_redirects`),`/* /.netlify/functions/ssr 200
|
|
214
214
|
`);let s=await J(e),c=n.resolve(r,`dist/client`);for(let{url:e,html:r}of s){let i=e===`/`?n.join(c,`index.html`):n.join(c,e,`index.html`);t.mkdirSync(n.resolve(i,`..`),{recursive:!0}),t.writeFileSync(i,r)}console.log(` Netlify output → .netlify/functions-internal/ssr/
|
|
215
215
|
Publish dir: dist/client/
|
|
216
|
-
`)}}}function
|
|
216
|
+
`)}}}function jn(){return{name:`node`,async build(e){let{fs:t,path:n,root:r}=e,i=G(e,{platformImport:`import { serve } from "@hono/node-server";
|
|
217
217
|
import { readFileSync, existsSync } from "node:fs";
|
|
218
218
|
import { resolve, dirname } from "node:path";
|
|
219
219
|
import { fileURLToPath } from "node:url";`,platformMiddleware:`
|
|
@@ -243,12 +243,12 @@ serve({ fetch: app.fetch, port }, (info) => {
|
|
|
243
243
|
});
|
|
244
244
|
`}),a=n.resolve(r,`.node-entry.tmp.mjs`);t.writeFileSync(a,i);try{await K(e,{entry:`.node-entry.tmp.mjs`,outDir:n.resolve(r,`dist/server`),target:`node18`,emptyOutDir:!1})}finally{t.rmSync(a,{force:!0})}let o=await J(e);if(o.length>0){let e=n.resolve(r,`dist/prerender`);t.mkdirSync(e,{recursive:!0});for(let{url:r,html:i}of o){let a=r===`/`?n.join(e,`index.html`):n.join(e,r,`index.html`);t.mkdirSync(n.resolve(a,`..`),{recursive:!0}),t.writeFileSync(a,i)}}console.log(` Node output → dist/server/index.mjs
|
|
245
245
|
Run: node dist/server/index.mjs
|
|
246
|
-
`)}}}function
|
|
247
|
-
`)}}}async function
|
|
248
|
-
<style>`+n+`</style>`,body:r,data:`<script id="serialized-server-data" type="application/json">`+i+`<\/script>`};return e.replace(a,(e,t)=>o[t]??``)}function
|
|
246
|
+
`)}}}function Mn(e={}){return{name:`static`,async build(t){let{fs:n,path:r,root:i}=t,a=r.resolve(i,`dist/static`);n.rmSync(a,{recursive:!0,force:!0}),n.mkdirSync(a,{recursive:!0});let{pathToFileURL:o}=await H(`node:url`),s=o(r.resolve(i,`dist/server/ssr.js`)).href,c=await H(s);t.copyStaticAssets(a,{excludeHtml:!0});let{paths:l,defs:u}=await Nn(t,e);console.log(` Pre-rendering ${l.length} pages...\n`);for(let e of l)try{let i=In(e,u.find(t=>t.path===e)?.renderMode,t.renderModes),o;if(i===`csr`)o=Fn(t.templateHtml);else{let{html:n,head:r,css:i,serverData:a}=await c.render(e),s=c.serializeServerData(a);o=Pn(t.templateHtml,r,i,n,s)}let s=e===`/`?r.join(a,`index.html`):r.join(a,e,`index.html`);n.mkdirSync(r.resolve(s,`..`),{recursive:!0}),n.writeFileSync(s,o)}catch(t){console.warn(` [static] Failed to render ${e}:`,t)}console.log(` Static output → dist/static/
|
|
247
|
+
`)}}}async function Nn(e,t){let n=t.routesExport??`src/lib/bootstrap.ts`,r=[],i=[];try{let{pathToFileURL:t}=await H(`node:url`);await e.vite.build({root:e.root,build:{ssr:n,outDir:e.path.resolve(e.root,`dist/server`),emptyOutDir:!1,rollupOptions:{output:{entryFileNames:`_routes.mjs`}}},resolve:e.resolvedResolve});let a=t(e.path.resolve(e.root,`dist/server/_routes.mjs`)).href,o=await H(a),s=o.routes??o.default;if(Array.isArray(s))for(let e of s)e.path&&!e.path.includes(`:`)&&(r.push(e.path),i.push({path:e.path,renderMode:e.renderMode}));e.fs.rmSync(e.path.resolve(e.root,`dist/server/_routes.mjs`),{force:!0})}catch(e){console.warn(` [static] Could not load routes from "${n}". Using "/" only.`,e),r.length===0&&r.push(`/`)}if(t.dynamicRoutes)for(let e of t.dynamicRoutes)r.includes(e)||r.push(e);return r.length===0&&r.push(`/`),{paths:r,defs:i}}function Pn(e,t,n,r,i){let a=/<!--ssr-([a-z][a-z0-9-]*)-->/g,o={head:t+`
|
|
248
|
+
<style>`+n+`</style>`,body:r,data:`<script id="serialized-server-data" type="application/json">`+i+`<\/script>`};return e.replace(a,(e,t)=>o[t]??``)}function Fn(e){return e.replace(/<!--ssr-([a-z][a-z0-9-]*)-->/g,()=>``)}function In(e,t,n){if(n){if(n[e])return n[e];for(let[t,r]of Object.entries(n))if(t.includes(`*`)){let n=t.replace(/[.+?^${}()|[\]\\]/g,`\\$&`);if(RegExp(`^`+n.replace(/\*/g,`.*`)+`$`).test(e))return r}}return t??`ssr`}function Ln(){return{name:`vercel`,async build(e){let{fs:t,path:n,root:r}=e,i=n.resolve(r,`.vercel/output`);t.rmSync(i,{recursive:!0,force:!0});let a=G(e,{platformImport:`import { getRequestListener } from "@hono/node-server";`,platformExport:[`const _listener = getRequestListener(app.fetch);`,`export default (req, res) => {`,` const m = req.headers["x-now-route-matches"];`,` if (typeof m === "string") {`,` try {`,` const p = new URLSearchParams(m);`,` const c = p.get("1");`,` if (c != null) {`,` const qi = (req.url || "").indexOf("?");`,` const qs = qi !== -1 ? req.url.slice(qi) : "";`,` req.url = "/" + decodeURIComponent(c) + qs;`,` }`,` } catch {}`,` }`,` return _listener(req, res);`,`};`].join(`
|
|
249
249
|
`)}),o=n.resolve(r,`.vercel-entry.tmp.mjs`);t.writeFileSync(o,a);try{let i=n.resolve(r,`.vercel/output/functions/ssr.func`);await K(e,{entry:`.vercel-entry.tmp.mjs`,outDir:i,target:`node18`}),t.writeFileSync(n.resolve(i,`.vc-config.json`),JSON.stringify({runtime:`nodejs20.x`,handler:`index.mjs`,launcherType:`Nodejs`},null,2)),q(e,n.resolve(r,`.vercel/output/static`)),t.writeFileSync(n.resolve(r,`.vercel/output/config.json`),JSON.stringify({version:3,routes:[{handle:`filesystem`},{src:`/(.*)`,dest:`/ssr`}]},null,2))}finally{t.rmSync(o,{force:!0})}let s=await J(e),c=n.resolve(r,`.vercel/output/static`);for(let{url:e,html:r}of s){let i=e===`/`?n.join(c,`index.html`):n.join(c,e,`index.html`);t.mkdirSync(n.resolve(i,`..`),{recursive:!0}),t.writeFileSync(i,r)}if(s.length>0){let e=n.resolve(r,`.vercel/output/config.json`),i=JSON.parse(t.readFileSync(e,`utf-8`));i.overrides=i.overrides??{};for(let{url:e}of s){let t=e===`/`?`index.html`:`${e.replace(/^\//,``)}/index.html`;i.overrides[t]={path:e===`/`?`/`:e,contentType:`text/html; charset=utf-8`}}t.writeFileSync(e,JSON.stringify(i,null,2))}console.log(` Vercel output → .vercel/output/
|
|
250
|
-
`)}}}function Y(e){if(typeof e!=`string`)return e;switch(e){case`vercel`:return
|
|
251
|
-
`))}if(u)return{vite:a};if(!i){let e=a;if(!e){let{createServer:t}=await H(`vite`);e=await t({root:n,server:{middlewareMode:!0},appType:`custom`})}let{getRequestListener:i}=await H(`@hono/node-server`),{createServer:o}=await H(`node:http`),s=i(t.fetch);return o((t,n)=>{e.middlewares(t,n,()=>s(t,n))}).listen(r,()=>{d()}),{vite:e}}if(c)globalThis.Deno.serve({port:r},t.fetch);else if(!l){let{serveStatic:e}=await H(`@hono/node-server/serve-static`),i=await H(`node:path`),a=new
|
|
250
|
+
`)}}}function Y(e){if(typeof e!=`string`)return e;switch(e){case`vercel`:return Ln();case`cloudflare`:return kn();case`netlify`:return An();case`node`:return jn();case`static`:return Mn();case`auto`:return Rn();default:throw Error(`[finesoft] Unknown adapter: "${e}". Available: vercel, cloudflare, netlify, node, static, auto`)}}function Rn(){return{name:`auto`,async build(e){let t=zn();return console.log(` [auto] Detected platform: ${t}\n`),Y(t).build(e)}}}function zn(){return process.env.VERCEL?`vercel`:process.env.CF_PAGES?`cloudflare`:process.env.NETLIFY?`netlify`:`node`}function Bn(e,t=1){return((n,r)=>{if(typeof n==`string`&&n.startsWith(`/`)){let i=new Request(`http://localhost${n}`,r);return i.headers.set(`x-ssr-depth`,String(t)),Promise.resolve(e(i))}return globalThis.fetch(n,r)})}function Vn(e,t){if(!t)return null;let n=e.split(`?`)[0];if(t[n])return t[n];for(let[e,r]of Object.entries(t))if(e.includes(`*`)){let t=e.replace(/[.+?^${}()|[\]\\]/g,`\\$&`);if(RegExp(`^`+t.replace(/\*/g,`.*`)+`$`).test(n))return r}return null}function X(e){let{root:t,vite:n,isProduction:r,ssrEntryPath:i=`/src/ssr.ts`,ssrProductionModule:a,parentFetch:o,renderModes:s,defaultLocale:c}=e,l=new I,u=new j(1e3),d;async function f(e){if(!r&&n){let{readFileSync:r}=await H(`node:fs`),i=r((await H(`node:path`)).resolve(t,`index.html`),`utf-8`);return n.transformIndexHtml(e,i)}if(d)return d;if(globalThis.Deno!==void 0){let e=import.meta.url;return d=globalThis.Deno.readTextFileSync(new URL(`../dist/client/index.html`,e)),d}let{readFileSync:i}=await H(`node:fs`);return d=i((await H(`node:path`)).resolve(t,`dist/client/index.html`),`utf-8`),d}async function p(){if(!r&&n)return await n.ssrLoadModule(i);if(a)return H(a);let e=await H(`node:path`),{pathToFileURL:o}=await H(`node:url`),s=o(e.resolve(t,`dist/server/ssr.js`)).href;return H(s)}return l.get(`*`,async e=>{let t=parseInt(e.req.header(`x-ssr-depth`)??`0`,10);if(t>=5)return e.text(`SSR recursion loop detected`,508);let i=e.req.path+(e.req.url.includes(`?`)?`?`+e.req.url.split(`?`)[1]:``);try{let n=await f(i),r=await p();if(typeof r.render!=`function`||typeof r.serializeServerData!=`function`)throw Error(`[SSR] Module missing required exports: render, serializeServerData`);let{render:a,serializeServerData:l}=r,d=Vn(i,s);if(d===`csr`)return e.html(V(n,c?k(c):void 0));let m=u.get(i);if(m)return e.html(m);let h=o?Bn(o,t+1):void 0,g={request:e.req.raw};h&&(g.fetch=h);let{html:_,head:v,css:y,serverData:b,renderMode:x,redirect:S,slots:ee,locale:C,status:w,rewriteUrl:T}=await a(i,g);if(S)return e.redirect(S.url,S.status);if(x===`csr`)return e.html(V(n,C));let E=B({template:n,head:v,css:y,html:_,serializedData:l(b),slots:ee,locale:C});return(x===`prerender`||d===`prerender`)&&!w&&!T&&u.set(i,E),T&&e.header(`Content-Location`,T),w&&w>=400?e.html(E,w):e.html(E)}catch(t){return!r&&n&&n.ssrFixStacktrace(t),console.error(`[SSR Error]`,t),e.text(`Internal Server Error`,500)}}),l}function Z(){return{isDeno:globalThis.Deno!==void 0,isBun:globalThis.Bun!==void 0,isVercel:!!process.env.VERCEL,isProduction:process.env.NODE_ENV===`production`}}async function Hn(e,t=0){if(globalThis.Deno!==void 0){let n=new URL(e);for(let e=0;e<t;e++)n=new URL(`..`,n);return n.pathname}let n=await H(`node:path`),{fileURLToPath:r}=await H(`node:url`),i=n.normalize(n.dirname(r(e)));for(let e=0;e<t;e++)i=n.resolve(i,`..`);return i}async function Un(e){let{app:t,root:n,port:r=3e3,isProduction:i,vite:a,routes:o,ssrEntryPath:s}=e,{isDeno:c,isBun:l,isVercel:u}=e.runtime??Z();function d(){let e=[`\n Server running at http://localhost:${r}\n`];if(o&&o.length>0){e.push(` Routes:`);for(let t of o)e.push(` ${t}`);e.push(``)}s&&e.push(` SSR Entry: ${s}`),s&&e.push(``),console.log(e.join(`
|
|
251
|
+
`))}if(u)return{vite:a};if(!i){let e=a;if(!e){let{createServer:t}=await H(`vite`);e=await t({root:n,server:{middlewareMode:!0},appType:`custom`})}let{getRequestListener:i}=await H(`@hono/node-server`),{createServer:o}=await H(`node:http`),s=i(t.fetch);return o((t,n)=>{e.middlewares(t,n,()=>s(t,n))}).listen(r,()=>{d()}),{vite:e}}if(c)globalThis.Deno.serve({port:r},t.fetch);else if(!l){let{serveStatic:e}=await H(`@hono/node-server/serve-static`),i=await H(`node:path`),a=new I,o=i.resolve(n,`dist/client`);a.use(`/*`,e({root:o,rewriteRequestPath:e=>e.endsWith(`/`)?`/__nosuchfile__`:e})),a.route(`/`,t);let{serve:s}=await H(`@hono/node-server`);s({fetch:a.fetch,port:r},()=>{d()})}return{vite:a}}async function Wn(e={}){let{root:t,port:n=Number(process.env.PORT)||3e3,setup:r,proxies:i,ssr:a}=e,o=t??process.cwd(),{existsSync:s}=await H(`node:fs`),c=(await H(`node:path`)).resolve(o,`.env`);if(s(c))try{let{config:e}=await H(`dotenv`);e({path:c})}catch(e){console.warn(`[Server] Failed to load .env: ${e.message}`)}let l=Z(),u;if(!l.isProduction&&!l.isVercel){let{createServer:e}=await H(`vite`);u=await e({root:o,server:{middlewareMode:!0},appType:`custom`})}let d=new I;i?.length&&W(d,i),r&&await r(d);let f=X({root:o,vite:u,isProduction:l.isProduction,parentFetch:d.fetch.bind(d),...a});return d.route(`/`,f),await Un({app:d,root:o,port:n,isProduction:l.isProduction,vite:u,runtime:l,ssrEntryPath:a?.ssrEntryPath}),{app:d,vite:u,runtime:l}}function Gn(e,t,n){let r=t??[`zh`,`en`],i=n??r[0]??`en`;if(!e||e.length>1024)return i;let a=e.split(`,`);if(a.length>50)return i;let o=a.map(e=>{let[t,n]=e.trim().split(`;q=`),r=n?parseFloat(n):1;return{lang:t.trim().toLowerCase(),q:Number.isFinite(r)&&r>=0&&r<=1?r:0}}).filter(e=>e.q>0).sort((e,t)=>t.q-e.q);for(let{lang:e}of o){let t=e.split(`-`)[0];if(r.includes(t))return t}return i}const Q=`virtual:finesoft-front/i18n-loader`,Kn=`\0${Q}`;function qn(e){return typeof e.default==`function`?e.default:typeof e.setup==`function`?e.setup:Object.values(e).find(e=>typeof e==`function`)??null}function Jn(e,t){if(!t)return null;let n=e.split(`?`)[0];if(t[n])return t[n];for(let[e,r]of Object.entries(t))if(e.includes(`*`)){let t=e.replace(/[.+?^${}()|[\]\\]/g,`\\$&`);if(RegExp(`^`+t.replace(/\*/g,`.*`)+`$`).test(n))return r}return null}function Yn(e){return e.replace(/\\/g,`/`)}let $=!1;function Xn(){$||($=!0,console.log(`\n${(e=>`\x1b[33m${e}\x1b[0m`)(`[finesoft]`)} dev server is exposing source via /src/* and /@fs/* (HMR).\n`+(e=>`\x1b[2m${e}\x1b[0m`)(" Do NOT expose this server to untrusted networks; run `vp build && vp preview` for production.\n")))}async function Zn(e,t){let{existsSync:n}=await H(`node:fs`),r=await H(`node:path`),i=r.isAbsolute(t)?t:r.resolve(e,t);if(!n(i))throw Error(`[finesoftFrontViteConfig] i18n.messagesDir not found: ${t}`);let a=Yn(r.relative(e,i));if(!a||a.startsWith(`..`))throw Error(`[finesoftFrontViteConfig] i18n.messagesDir must stay inside the project root: ${t}`);return a.replace(/^\.\/+/,``)}function Qn(e={}){let t=e.ssr?.entry??`src/ssr.ts`,n=process.cwd(),r,i,a,o=/\.(css|scss|less|sass|styl|stylus|pcss|postcss)($|\?)/;return{name:`finesoft-front`,config(t){let n={appType:`custom`,define:{__FINESOFT_I18N_LOADER_SPECIFIER__:e.i18n?.messagesDir?JSON.stringify(Q):`undefined`}};return process.env.__FINESOFT_SUB_BUILD__||(n.build={outDir:t.build?.outDir??`dist/client`}),n},configResolved(e){r=e.command,i=e.resolve,a=e.css,n=e.root},resolveId(t){return t===Q&&e.i18n?.messagesDir?Kn:null},async load(t){if(t!==Kn||!e.i18n?.messagesDir)return null;let r=`/${await Zn(n,e.i18n.messagesDir)}`,i=`${r}/*.json`,a=`${r}/`;return`
|
|
252
252
|
const localeModules = import.meta.glob(${JSON.stringify(i)}, { import: "default" });
|
|
253
253
|
|
|
254
254
|
export async function loadMessages(locale) {
|
|
@@ -257,8 +257,8 @@ export async function loadMessages(locale) {
|
|
|
257
257
|
const messages = await loader();
|
|
258
258
|
return messages ?? undefined;
|
|
259
259
|
}
|
|
260
|
-
`},transformIndexHtml:{order:`pre`,async handler(e,t){let n=t.server;if(!n)return;let r=(t.originalUrl||t.path||``).split(`?`)[0];if(/\.\w+$/.test(r)&&!r.endsWith(`.html`))return;let i=[...e.matchAll(/<script\b[^>]*\bsrc=["']([^"']+)["'][^>]*>/g)].find(e=>!e[1].startsWith(`/@`));if(!i)return;let a=i[1];try{await n.transformRequest(a)}catch{return}let
|
|
260
|
+
`},transformIndexHtml:{order:`pre`,async handler(e,t){let n=t.server;if(!n)return;let r=(t.originalUrl||t.path||``).split(`?`)[0];if(/\.\w+$/.test(r)&&!r.endsWith(`.html`))return;let i=[...e.matchAll(/<script\b[^>]*\bsrc=["']([^"']+)["'][^>]*>/g)].find(e=>!e[1].startsWith(`/@`));if(!i)return;let a=i[1];try{await n.transformRequest(a)}catch{return}let s=[],c=new Set;function l(e,t=0){if(!(t>100)&&!(!e?.url||c.has(e.url))&&(c.add(e.url),o.test(e.url)&&!e.url.includes(`.svelte`)&&s.push(e.url),e.importedModules))for(let n of e.importedModules)l(n,t+1)}let u=await n.moduleGraph.getModuleByUrl(a);if(u&&l(u),s.length===0)return;let d=[];for(let e of s)try{let t=(await n.ssrLoadModule(e))?.default;typeof t==`string`&&t.length>0&&d.push({tag:`style`,attrs:{"data-vite-dev-id":e},children:t,injectTo:`head`})}catch{}return d}},configureServer(r){return async()=>{let{Hono:i}=await H(`hono`),{getRequestListener:a}=await H(`@hono/node-server`);Xn();let o=new i;if(e.proxies?.length&&W(o,e.proxies),typeof e.setup==`function`)await e.setup(o);else if(typeof e.setup==`string`){let t=qn(await r.ssrLoadModule(`/`+e.setup));t&&await t(o)}let s=X({root:n,vite:r,isProduction:!1,ssrEntryPath:`/`+t,parentFetch:o.fetch.bind(o),renderModes:e.renderModes,defaultLocale:e.defaultLocale});o.route(`/`,s);let c=a(o.fetch);r.middlewares.use((e,t)=>{c(e,t)})}},configurePreviewServer(t){return async()=>{let{readFileSync:r}=await H(`node:fs`),i=await H(`node:path`),{pathToFileURL:a}=await H(`node:url`),{Hono:o}=await H(`hono`),{getRequestListener:s}=await H(`@hono/node-server`),c=new o,l=new j(1e3);if(e.proxies?.length&&W(c,e.proxies),typeof e.setup==`function`)await e.setup(c);else if(typeof e.setup==`string`)try{let e=a(i.resolve(n,`dist/server/setup.mjs`)).href,t=qn(await H(e));t&&await t(c)}catch{console.warn(`[finesoft] Could not load setup module for preview. API routes disabled.`)}let u=r(i.resolve(n,`dist/client/index.html`),`utf-8`),d=a(i.resolve(n,`dist/server/ssr.js`)).href,f=await H(d);c.get(`*`,async t=>{let n=parseInt(t.req.header(`x-ssr-depth`)??`0`,10);if(n>=5)return t.text(`SSR recursion loop detected`,508);let r=t.req.path+(t.req.url.includes(`?`)?`?`+t.req.url.split(`?`)[1]:``);try{let i=Jn(r,e.renderModes);if(i===`csr`)return t.html(V(u,e.defaultLocale?k(e.defaultLocale):void 0));let a=l.get(r);if(a)return t.html(a);let{html:o,head:s,css:d,serverData:p,renderMode:m,redirect:h,slots:g,locale:_,status:v,rewriteUrl:y}=await f.render(r,{fetch:Bn(c.fetch.bind(c),n+1)});if(h)return t.redirect(h.url,h.status);if(m===`csr`)return t.html(V(u,_));let b=B({template:u,head:s,css:d,html:o,serializedData:f.serializeServerData(p),slots:g,locale:_});return(m===`prerender`||i===`prerender`)&&!v&&!y&&l.set(r,b),y&&t.header(`Content-Location`,y),v&&v>=400?t.html(b,v):t.html(b)}catch(e){return console.error(`[SSR Preview Error]`,e),t.text(`Internal Server Error`,500)}});let p=s(c.fetch);t.middlewares.use((e,t)=>{p(e,t)})}},async closeBundle(){if(!process.env.__FINESOFT_SUB_BUILD__&&r===`build`){process.env.__FINESOFT_SUB_BUILD__=`1`;try{let r=await H(`vite`),o=await H(`node:fs`),s=await H(`node:path`);if(console.log(`
|
|
261
261
|
Building SSR bundle...
|
|
262
|
-
`),await r.build({root:n,build:{ssr:t,outDir:`dist/server`},ssr:{external:
|
|
263
|
-
`),await r.build({root:n,build:{ssr:e.setup,outDir:`dist/server`,emptyOutDir:!1,rollupOptions:{output:{entryFileNames:`setup.mjs`}}},resolve:i})),e.adapter){let c=Y(e.adapter),l=o.readFileSync(s.resolve(n,`dist/client/index.html`),`utf-8`),u={root:n,ssrEntry:t,setupPath:typeof e.setup==`string`?e.setup:void 0,bootstrapEntry:e.bootstrapEntry,templateHtml:l,renderModes:e.renderModes,proxies:e.proxies,locales:e.locales,defaultLocale:e.defaultLocale,resolvedResolve:i,resolvedCss:a,vite:r,fs:o,path:s,generateSSREntry(e){return G(u,e)},buildBundle(e){return K(u,e)},copyStaticAssets(e,t){return q(u,e,t)}};console.log(` Running adapter: ${c.name}...\n`),await c.build(u)}}finally{delete process.env.__FINESOFT_SUB_BUILD__}}}}}export{
|
|
262
|
+
`),await r.build({root:n,build:{ssr:t,outDir:`dist/server`},ssr:{external:On},resolve:i,css:a}),typeof e.setup==`string`&&(console.log(` Building setup module...
|
|
263
|
+
`),await r.build({root:n,build:{ssr:e.setup,outDir:`dist/server`,emptyOutDir:!1,rollupOptions:{output:{entryFileNames:`setup.mjs`}}},resolve:i})),e.adapter){let c=Y(e.adapter),l=o.readFileSync(s.resolve(n,`dist/client/index.html`),`utf-8`),u={root:n,ssrEntry:t,setupPath:typeof e.setup==`string`?e.setup:void 0,bootstrapEntry:e.bootstrapEntry,templateHtml:l,renderModes:e.renderModes,proxies:e.proxies,locales:e.locales,defaultLocale:e.defaultLocale,resolvedResolve:i,resolvedCss:a,vite:r,fs:o,path:s,generateSSREntry(e){return G(u,e)},buildBundle(e){return K(u,e)},copyStaticAssets(e,t){return q(u,e,t)}};console.log(` Running adapter: ${c.name}...\n`),await c.build(u)}}finally{delete process.env.__FINESOFT_SUB_BUILD__}}}}}export{Pe as ACTION_KINDS,zt as ActionDispatcher,P as BASE_PAGE_FIELDS,Je as BaseController,Ce as BaseLogger,ht as CompositeEventRecorder,De as CompositeLogger,ce as CompositeLoggerFactory,_e as ConsoleEventRecorder,C as ConsoleLogger,yt as ConsoleLoggerFactory,ke as Container,p as DEFAULT_NAV_PARAM,a as DEP_KEYS,Bt as FINESOFT_PUBLIC,c as Framework,St as History,We as HostGuardError,gt as HttpClient,ct as HttpError,Mt as IntentDispatcher,Ue as IntersectionImpressionObserver,j as LruMap,At as NAVIGATION_NODE_KINDS,ne as NAVIGATION_OP_KINDS,Xt as NAVIGATION_TREE_INTENT_ID,Be as NavigationError,Ft as PrefetchedIntents,xe as ReportingLogger,g as ReportingLoggerFactory,b as Router,Ge as SPLIT_VISIBILITIES,Kt as SSR_PLACEHOLDERS,t as SimpleTranslator,Re as VoidEventRecorder,Ot as WithFieldsRecorder,Rn as autoAdapter,r as bool,It as buildUrl,Xe as classifyHost,qe as classifyUrl,kn as cloudflareAdapter,ge as collectVisibleDestinations,y as createActiveLeafCodec,jt as createBrowserContext,w as createFullStateCodec,Qe as createNavigationBridge,D as createNavigationController,ut as createPrefetchedIntentsFromDom,X as createSSRApp,dn as createSSRNavigationRender,Gt as createSSRRender,Wn as createServer,F as createServerContext,le as decodeNavigationTreeParam,E as defineNavigation,Ht as defineRequestScopedKey,n as defineRoutes,st as deny,i as deserializeNavigation,bt as deserializeServerData,v as detectPlatform,Z as detectRuntime,Vt as encodeNavigationTreeParam,Ve as englishPlural,on as extractNavigationTree,be as findNearestStack,h as findNode,Qn as finesoftFrontViteConfig,En as generateProxyCode,Ne as generateUuid,de as getBaseUrl,k as getLocaleAttributes,d as getPWADisplayMode,A as getPublicFields,mt as getTextDirection,V as injectCSRShell,B as injectSSRContent,nt as int,Et as interpolate,Lt as isCompoundAction,fe as isExternalUrlAction,s as isFlowAction,ft as isLeafNode,l as isNone,Rt as isPublicMarked,Ct as isRtl,ie as isSome,xt as isSplitNode,et as isStackNode,Me as isTabsNode,M as leaf,ye as makeDependencies,Pt as makeExternalUrlAction,me as makeFlowAction,Ie as makeLocaleInfo,T as makeSchema,_t as mapEach,O as markPublic,An as netlifyAdapter,Ye as next,jn as nodeAdapter,te as num,re as oneOf,ae as optional,Gn as parseAcceptLanguage,lt as pipe,Ze as pipeAsync,ee as pop,vt as popTo,x as popToRoot,we as push,Ke as redirect,je as registerActionHandlers,it as registerExternalUrlHandler,pt as registerFlowActionHandler,W as registerProxyRoutes,o as removeHost,Nt as removeQueryParams,pe as removeScheme,Se as replaceTop,S as resetFilterCache,Ee as resolveActivePath,Y as resolveAdapter,N as resolveConfiguredMessages,at as resolveLocaleFromUrl,$e as resolveMessages,dt as resolvePluralKey,Hn as resolveRoot,Oe as rewrite,tt as route,f as runAfterLoadGuards,u as runBeforeLoadGuards,ue as runStandard,Ae as safeErrorPage,ze as secureFetch,se as selectColumn,e as selectTab,ve as serializeNavigation,_ as serializeNavigationStable,hn as serializeServerData,kt as setHtmlLocaleAttributes,He as setVisibility,Te as shouldLog,wt as split,L as ssrRender,Zt as ssrRenderNavigation,he as stableStringify,Le as stack,Tt as startBrowserApp,Un as startServer,Mn as staticAdapter,oe as str,sn as stripNavigationTree,ot as tabs,Fe as tryScroll,m as uuid,Ln as vercelAdapter,Dt as visibleSplitColumns,rt as withDefault};
|
|
264
264
|
//# sourceMappingURL=index.mjs.map
|