@finesoft/front 0.1.37 → 0.1.39

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/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { FrameworkConfig, Framework, BasePage, PrefetchedIntent } from './browser.cjs';
2
- export { ACTION_KINDS, Action, ActionDispatcher, ActionHandler, ActionHandlerDependencies, AsyncMapper, BaseController, BaseItem, BaseLogger, BaseShelf, BrowserAppConfig, CompositeLogger, CompositeLoggerFactory, CompoundAction, ConsoleLogger, ConsoleLoggerFactory, Container, DEP_KEYS, ExternalUrlAction, ExternalUrlDependencies, FeatureFlags, FlowAction, FlowActionCallbacks, FlowActionDependencies, History, HttpClient, HttpClientConfig, HttpError, Intent, IntentController, IntentDispatcher, Locale, Logger, LoggerFactory, Logger as LoggerInterface, LruMap, Mapper, MetricsRecorder, Net, None, Optional, PrefetchedIntents, RenderMode, RouteDefinition, RouteMatch, Router, Storage, buildUrl, createPrefetchedIntentsFromDom, defineRoutes, deserializeServerData, generateUuid, getBaseUrl, isCompoundAction, isExternalUrlAction, isFlowAction, isNone, isSome, makeDependencies, makeExternalUrlAction, makeFlowAction, mapEach, pipe, pipeAsync, registerActionHandlers, registerExternalUrlHandler, registerFlowActionHandler, removeHost, removeQueryParams, removeScheme, resetFilterCache, shouldLog, stableStringify, startBrowserApp, tryScroll } from './browser.cjs';
2
+ export { ACTION_KINDS, Action, ActionDispatcher, ActionHandler, ActionHandlerDependencies, AfterLoadGuard, AsyncMapper, BaseController, BaseItem, BaseLogger, BaseShelf, BeforeLoadGuard, BrowserAppConfig, BrowserContextOptions, CompositeLogger, CompositeLoggerFactory, CompoundAction, ConsoleLogger, ConsoleLoggerFactory, Container, DEP_KEYS, DenyResult, ExternalUrlAction, ExternalUrlDependencies, FeatureFlags, FlowAction, FlowActionCallbacks, FlowActionDependencies, History, HttpClient, HttpClientConfig, HttpError, Intent, IntentController, IntentDispatcher, Locale, Logger, LoggerFactory, Logger as LoggerInterface, LruMap, Mapper, MetricsRecorder, MiddlewareResult, NavigationContext, Net, NextResult, None, Optional, PostLoadContext, PrefetchedIntents, RedirectResult, RenderMode, RewriteResult, RouteAddOptions, RouteDefinition, RouteMatch, Router, ServerContextOptions, Storage, buildUrl, createBrowserContext, createPrefetchedIntentsFromDom, createServerContext, defineRoutes, deny, deserializeServerData, generateUuid, getBaseUrl, isCompoundAction, isExternalUrlAction, isFlowAction, isNone, isSome, makeDependencies, makeExternalUrlAction, makeFlowAction, mapEach, next, pipe, pipeAsync, redirect, registerActionHandlers, registerExternalUrlHandler, registerFlowActionHandler, removeHost, removeQueryParams, removeScheme, resetFilterCache, rewrite, runAfterLoadGuards, runBeforeLoadGuards, shouldLog, stableStringify, startBrowserApp, tryScroll } from './browser.cjs';
3
3
  import * as node_fs from 'node:fs';
4
4
  import { Hono } from 'hono';
5
5
  import { ViteDevServer } from 'vite';
@@ -31,6 +31,8 @@ interface SSRRenderOptions {
31
31
  interface SSRContext {
32
32
  /** 自定义 fetch(如 Hono 内部路由回环) */
33
33
  fetch?: typeof globalThis.fetch;
34
+ /** 原始 Request 对象(用于中间件读取 cookie/header) */
35
+ request?: Request;
34
36
  }
35
37
  interface SSRAppResult {
36
38
  html: string;
@@ -44,6 +46,11 @@ interface SSRRenderResult {
44
46
  serverData: PrefetchedIntent[];
45
47
  /** 该路由的渲染模式(由 Router 返回) */
46
48
  renderMode?: string;
49
+ /** 中间件要求的重定向(服务端应返回 HTTP 301/302) */
50
+ redirect?: {
51
+ url: string;
52
+ status: number;
53
+ };
47
54
  }
48
55
  declare function ssrRender(options: SSRRenderOptions): Promise<SSRRenderResult>;
49
56
 
@@ -337,12 +344,17 @@ declare function vercelAdapter(): Adapter;
337
344
  interface SSRModule {
338
345
  render: (url: string, locale: string, ssrContext?: {
339
346
  fetch?: typeof globalThis.fetch;
347
+ request?: Request;
340
348
  }) => Promise<{
341
349
  html: string;
342
350
  head: string;
343
351
  css: string;
344
352
  serverData: unknown;
345
353
  renderMode?: string;
354
+ redirect?: {
355
+ url: string;
356
+ status: number;
357
+ };
346
358
  }>;
347
359
  serializeServerData: (data: unknown) => string;
348
360
  }
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { FrameworkConfig, Framework, BasePage, PrefetchedIntent } from './browser.js';
2
- export { ACTION_KINDS, Action, ActionDispatcher, ActionHandler, ActionHandlerDependencies, AsyncMapper, BaseController, BaseItem, BaseLogger, BaseShelf, BrowserAppConfig, CompositeLogger, CompositeLoggerFactory, CompoundAction, ConsoleLogger, ConsoleLoggerFactory, Container, DEP_KEYS, ExternalUrlAction, ExternalUrlDependencies, FeatureFlags, FlowAction, FlowActionCallbacks, FlowActionDependencies, History, HttpClient, HttpClientConfig, HttpError, Intent, IntentController, IntentDispatcher, Locale, Logger, LoggerFactory, Logger as LoggerInterface, LruMap, Mapper, MetricsRecorder, Net, None, Optional, PrefetchedIntents, RenderMode, RouteDefinition, RouteMatch, Router, Storage, buildUrl, createPrefetchedIntentsFromDom, defineRoutes, deserializeServerData, generateUuid, getBaseUrl, isCompoundAction, isExternalUrlAction, isFlowAction, isNone, isSome, makeDependencies, makeExternalUrlAction, makeFlowAction, mapEach, pipe, pipeAsync, registerActionHandlers, registerExternalUrlHandler, registerFlowActionHandler, removeHost, removeQueryParams, removeScheme, resetFilterCache, shouldLog, stableStringify, startBrowserApp, tryScroll } from './browser.js';
2
+ export { ACTION_KINDS, Action, ActionDispatcher, ActionHandler, ActionHandlerDependencies, AfterLoadGuard, AsyncMapper, BaseController, BaseItem, BaseLogger, BaseShelf, BeforeLoadGuard, BrowserAppConfig, BrowserContextOptions, CompositeLogger, CompositeLoggerFactory, CompoundAction, ConsoleLogger, ConsoleLoggerFactory, Container, DEP_KEYS, DenyResult, ExternalUrlAction, ExternalUrlDependencies, FeatureFlags, FlowAction, FlowActionCallbacks, FlowActionDependencies, History, HttpClient, HttpClientConfig, HttpError, Intent, IntentController, IntentDispatcher, Locale, Logger, LoggerFactory, Logger as LoggerInterface, LruMap, Mapper, MetricsRecorder, MiddlewareResult, NavigationContext, Net, NextResult, None, Optional, PostLoadContext, PrefetchedIntents, RedirectResult, RenderMode, RewriteResult, RouteAddOptions, RouteDefinition, RouteMatch, Router, ServerContextOptions, Storage, buildUrl, createBrowserContext, createPrefetchedIntentsFromDom, createServerContext, defineRoutes, deny, deserializeServerData, generateUuid, getBaseUrl, isCompoundAction, isExternalUrlAction, isFlowAction, isNone, isSome, makeDependencies, makeExternalUrlAction, makeFlowAction, mapEach, next, pipe, pipeAsync, redirect, registerActionHandlers, registerExternalUrlHandler, registerFlowActionHandler, removeHost, removeQueryParams, removeScheme, resetFilterCache, rewrite, runAfterLoadGuards, runBeforeLoadGuards, shouldLog, stableStringify, startBrowserApp, tryScroll } from './browser.js';
3
3
  import * as node_fs from 'node:fs';
4
4
  import { Hono } from 'hono';
5
5
  import { ViteDevServer } from 'vite';
@@ -31,6 +31,8 @@ interface SSRRenderOptions {
31
31
  interface SSRContext {
32
32
  /** 自定义 fetch(如 Hono 内部路由回环) */
33
33
  fetch?: typeof globalThis.fetch;
34
+ /** 原始 Request 对象(用于中间件读取 cookie/header) */
35
+ request?: Request;
34
36
  }
35
37
  interface SSRAppResult {
36
38
  html: string;
@@ -44,6 +46,11 @@ interface SSRRenderResult {
44
46
  serverData: PrefetchedIntent[];
45
47
  /** 该路由的渲染模式(由 Router 返回) */
46
48
  renderMode?: string;
49
+ /** 中间件要求的重定向(服务端应返回 HTTP 301/302) */
50
+ redirect?: {
51
+ url: string;
52
+ status: number;
53
+ };
47
54
  }
48
55
  declare function ssrRender(options: SSRRenderOptions): Promise<SSRRenderResult>;
49
56
 
@@ -337,12 +344,17 @@ declare function vercelAdapter(): Adapter;
337
344
  interface SSRModule {
338
345
  render: (url: string, locale: string, ssrContext?: {
339
346
  fetch?: typeof globalThis.fetch;
347
+ request?: Request;
340
348
  }) => Promise<{
341
349
  html: string;
342
350
  head: string;
343
351
  css: string;
344
352
  serverData: unknown;
345
353
  renderMode?: string;
354
+ redirect?: {
355
+ url: string;
356
+ status: number;
357
+ };
346
358
  }>;
347
359
  serializeServerData: (data: unknown) => string;
348
360
  }
package/dist/index.js CHANGED
@@ -7,13 +7,13 @@ import {
7
7
  registerFlowActionHandler,
8
8
  startBrowserApp,
9
9
  tryScroll
10
- } from "./chunk-AX7PXYXU.js";
10
+ } from "./chunk-4PPCVAKZ.js";
11
11
  import {
12
12
  MAX_SSR_DEPTH,
13
13
  SSR_DEPTH_HEADER,
14
14
  createInternalFetch,
15
15
  createSSRApp
16
- } from "./chunk-SFGR32K6.js";
16
+ } from "./chunk-OYTIGVEG.js";
17
17
  import {
18
18
  SSR_PLACEHOLDERS,
19
19
  createSSRRender,
@@ -21,7 +21,7 @@ import {
21
21
  injectSSRContent,
22
22
  serializeServerData,
23
23
  ssrRender
24
- } from "./chunk-AYO3UUQC.js";
24
+ } from "./chunk-XQ3UWZOS.js";
25
25
  import {
26
26
  ACTION_KINDS,
27
27
  ActionDispatcher,
@@ -41,7 +41,10 @@ import {
41
41
  PrefetchedIntents,
42
42
  Router,
43
43
  buildUrl,
44
+ createBrowserContext,
45
+ createServerContext,
44
46
  defineRoutes,
47
+ deny,
45
48
  generateUuid,
46
49
  getBaseUrl,
47
50
  isCompoundAction,
@@ -53,15 +56,20 @@ import {
53
56
  makeExternalUrlAction,
54
57
  makeFlowAction,
55
58
  mapEach,
59
+ next,
56
60
  pipe,
57
61
  pipeAsync,
62
+ redirect,
58
63
  removeHost,
59
64
  removeQueryParams,
60
65
  removeScheme,
61
66
  resetFilterCache,
67
+ rewrite,
68
+ runAfterLoadGuards,
69
+ runBeforeLoadGuards,
62
70
  shouldLog,
63
71
  stableStringify
64
- } from "./chunk-OXKFPW4U.js";
72
+ } from "./chunk-SDPWQT2T.js";
65
73
  import {
66
74
  parseAcceptLanguage
67
75
  } from "./chunk-PSPVIVC2.js";
@@ -144,7 +152,7 @@ function _sanitizeProxyPath(raw) {
144
152
  const pattern = `"${config.prefix}/*"`;
145
153
  const headersJson = JSON.stringify(config.headers ?? {});
146
154
  const cacheStr = config.cache ? JSON.stringify(config.cache) : "null";
147
- const redirect = config.followRedirects ? '"follow"' : '"manual"';
155
+ const redirect2 = config.followRedirects ? '"follow"' : '"manual"';
148
156
  let authCode = "";
149
157
  if (config.auth) {
150
158
  const envKey = JSON.stringify(config.auth.envKey);
@@ -163,7 +171,7 @@ function _sanitizeProxyPath(raw) {
163
171
  _reqUrl.searchParams.forEach((v, k) => _target.searchParams.set(k, v));
164
172
  const _headers = ${headersJson};${authCode}
165
173
  try {
166
- const _resp = await fetch(_target.toString(), { headers: _headers, redirect: ${redirect} });
174
+ const _resp = await fetch(_target.toString(), { headers: _headers, redirect: ${redirect2} });
167
175
  const _body = await _resp.text();
168
176
  const _rh = { "Content-Type": _resp.headers.get("Content-Type") || "application/json" };
169
177
  if (${cacheStr}) _rh["Cache-Control"] = ${cacheStr};
@@ -1313,7 +1321,7 @@ function finesoftFrontViteConfig(options = {}) {
1313
1321
  /* @vite-ignore */
1314
1322
  "hono"
1315
1323
  );
1316
- const { createSSRApp: createSSRApp2 } = await import("./app-D4K35MX3.js");
1324
+ const { createSSRApp: createSSRApp2 } = await import("./app-XEMPAI6H.js");
1317
1325
  const { getRequestListener } = await import(
1318
1326
  /* @vite-ignore */
1319
1327
  "@hono/node-server"
@@ -1367,7 +1375,7 @@ function finesoftFrontViteConfig(options = {}) {
1367
1375
  );
1368
1376
  const { injectSSRContent: injectSSRContent2, injectCSRShell: injectCSRShell2 } = await import(
1369
1377
  /* @vite-ignore */
1370
- "./src-MVACJWBF.js"
1378
+ "./src-XNC7QNVI.js"
1371
1379
  );
1372
1380
  const { parseAcceptLanguage: parseAcceptLanguage2 } = await import("./locale-CAZ4INCX.js");
1373
1381
  const { getRequestListener } = await import(
@@ -1582,11 +1590,14 @@ export {
1582
1590
  autoAdapter,
1583
1591
  buildUrl,
1584
1592
  cloudflareAdapter,
1593
+ createBrowserContext,
1585
1594
  createPrefetchedIntentsFromDom,
1586
1595
  createSSRApp,
1587
1596
  createSSRRender,
1588
1597
  createServer,
1598
+ createServerContext,
1589
1599
  defineRoutes,
1600
+ deny,
1590
1601
  deserializeServerData,
1591
1602
  detectRuntime,
1592
1603
  finesoftFrontViteConfig,
@@ -1605,10 +1616,12 @@ export {
1605
1616
  makeFlowAction,
1606
1617
  mapEach,
1607
1618
  netlifyAdapter,
1619
+ next,
1608
1620
  nodeAdapter,
1609
1621
  parseAcceptLanguage,
1610
1622
  pipe,
1611
1623
  pipeAsync,
1624
+ redirect,
1612
1625
  registerActionHandlers,
1613
1626
  registerExternalUrlHandler,
1614
1627
  registerFlowActionHandler,
@@ -1619,6 +1632,9 @@ export {
1619
1632
  resetFilterCache,
1620
1633
  resolveAdapter,
1621
1634
  resolveRoot,
1635
+ rewrite,
1636
+ runAfterLoadGuards,
1637
+ runBeforeLoadGuards,
1622
1638
  serializeServerData,
1623
1639
  shouldLog,
1624
1640
  ssrRender,