@modern-js/server-core 3.8.3 → 3.9.1

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.
Files changed (63) hide show
  1. package/dist/cjs/plugins/compat/hooks.js +0 -1
  2. package/dist/cjs/plugins/compat/index.js +0 -1
  3. package/dist/cjs/plugins/render/inject.js +3 -13
  4. package/dist/cjs/plugins/render/render.js +9 -8
  5. package/dist/esm/plugins/compat/hooks.mjs +0 -1
  6. package/dist/esm/plugins/compat/index.mjs +1 -2
  7. package/dist/esm/plugins/render/inject.mjs +3 -13
  8. package/dist/esm/plugins/render/render.mjs +13 -13
  9. package/dist/esm-node/plugins/compat/hooks.mjs +0 -1
  10. package/dist/esm-node/plugins/compat/index.mjs +1 -2
  11. package/dist/esm-node/plugins/render/inject.mjs +3 -13
  12. package/dist/esm-node/plugins/render/render.mjs +13 -11
  13. package/dist/types/adapters/node/helper/index.d.ts +6 -6
  14. package/dist/types/adapters/node/helper/loadCache.d.ts +1 -1
  15. package/dist/types/adapters/node/helper/loadConfig.d.ts +1 -1
  16. package/dist/types/adapters/node/helper/loadEnv.d.ts +1 -1
  17. package/dist/types/adapters/node/helper/loadPlugin.d.ts +1 -1
  18. package/dist/types/adapters/node/helper/utils.d.ts +1 -1
  19. package/dist/types/adapters/node/hono.d.ts +2 -2
  20. package/dist/types/adapters/node/index.d.ts +5 -5
  21. package/dist/types/adapters/node/node.d.ts +1 -1
  22. package/dist/types/adapters/node/plugins/index.d.ts +3 -3
  23. package/dist/types/adapters/node/plugins/nodeServer.d.ts +1 -1
  24. package/dist/types/adapters/node/plugins/resource.d.ts +1 -1
  25. package/dist/types/adapters/node/plugins/static.d.ts +1 -1
  26. package/dist/types/helper.d.ts +1 -1
  27. package/dist/types/index.d.ts +13 -13
  28. package/dist/types/plugins/compat/hooks.d.ts +1 -1
  29. package/dist/types/plugins/compat/index.d.ts +2 -2
  30. package/dist/types/plugins/default.d.ts +2 -2
  31. package/dist/types/plugins/favicon.d.ts +1 -1
  32. package/dist/types/plugins/index.d.ts +8 -8
  33. package/dist/types/plugins/log.d.ts +1 -1
  34. package/dist/types/plugins/middlewares.d.ts +1 -1
  35. package/dist/types/plugins/monitors.d.ts +1 -1
  36. package/dist/types/plugins/processedBy.d.ts +1 -1
  37. package/dist/types/plugins/render/csrRscRender.d.ts +1 -1
  38. package/dist/types/plugins/render/dataHandler.d.ts +1 -1
  39. package/dist/types/plugins/render/index.d.ts +2 -2
  40. package/dist/types/plugins/render/inject.d.ts +2 -2
  41. package/dist/types/plugins/render/render.d.ts +4 -5
  42. package/dist/types/plugins/render/renderRscHandler.d.ts +1 -1
  43. package/dist/types/plugins/render/serverActionHandler.d.ts +1 -1
  44. package/dist/types/plugins/render/ssrCache.d.ts +1 -1
  45. package/dist/types/plugins/render/ssrRender.d.ts +2 -2
  46. package/dist/types/plugins/render/utils.d.ts +2 -2
  47. package/dist/types/plugins/route.d.ts +1 -1
  48. package/dist/types/serverBase.d.ts +2 -2
  49. package/dist/types/types/config/index.d.ts +14 -14
  50. package/dist/types/types/config/source.d.ts +1 -1
  51. package/dist/types/types/index.d.ts +4 -4
  52. package/dist/types/types/plugins/base.d.ts +4 -16
  53. package/dist/types/types/plugins/index.d.ts +2 -2
  54. package/dist/types/types/plugins/plugin.d.ts +3 -5
  55. package/dist/types/types/render.d.ts +1 -1
  56. package/dist/types/types/requestHandler.d.ts +1 -1
  57. package/dist/types/types/server.d.ts +1 -1
  58. package/dist/types/utils/index.d.ts +9 -9
  59. package/dist/types/utils/publicDir.d.ts +1 -1
  60. package/dist/types/utils/serverConfig.d.ts +1 -1
  61. package/package.json +6 -6
  62. /package/dist/esm/{rslib-runtime.mjs → rslib-runtime~1.mjs} +0 -0
  63. /package/dist/esm-node/{rslib-runtime.mjs → rslib-runtime~0.mjs} +0 -0
@@ -33,7 +33,6 @@ function getHookRunners(context) {
33
33
  config: (params)=>hooks.modifyConfig.call(params),
34
34
  prepare: ()=>hooks.onPrepare.call(),
35
35
  reset: (params)=>hooks.onReset.call(params),
36
- fallback: (input)=>hooks.fallback.call(input),
37
36
  prepareWebServer: (input)=>hooks.prepareWebServer.call(input),
38
37
  prepareApiServer: (input)=>hooks.prepareApiServer.call(input),
39
38
  afterMatch: (ctx)=>hooks.afterMatch.call(ctx),
@@ -36,7 +36,6 @@ const external_hooks_js_namespaceObject = require("./hooks.js");
36
36
  const compatPlugin = ()=>({
37
37
  name: '@modern-js/server-compat',
38
38
  registryHooks: {
39
- fallback: (0, plugin_namespaceObject.createAsyncHook)(),
40
39
  prepareWebServer: (0, plugin_namespaceObject.createAsyncPipelineHook)(),
41
40
  prepareApiServer: (0, plugin_namespaceObject.createAsyncPipelineHook)(),
42
41
  afterMatch: (0, plugin_namespaceObject.createAsyncPipelineHook)(),
@@ -38,23 +38,14 @@ const injectRenderHandlerPlugin = ({ staticGenerate, cacheConfig })=>({
38
38
  api.onPrepare(async ()=>{
39
39
  const { distDirectory: pwd, routes, metaName } = api.getServerContext();
40
40
  const config = api.getServerConfig();
41
- const hooks = api.getHooks();
42
41
  if (!routes) return;
43
- const onFallback = async (reason, error, context)=>{
44
- await hooks.fallback.call({
45
- reason,
46
- error,
47
- context
48
- });
49
- };
50
42
  const getRenderHandlerOptions = {
51
43
  pwd: pwd,
52
44
  routes,
53
45
  config,
54
46
  metaName,
55
47
  cacheConfig: cacheConfig,
56
- staticGenerate,
57
- onFallback
48
+ staticGenerate
58
49
  };
59
50
  const render = await getRenderHandler(getRenderHandlerOptions);
60
51
  api.updateServerContext({
@@ -64,7 +55,7 @@ const injectRenderHandlerPlugin = ({ staticGenerate, cacheConfig })=>({
64
55
  });
65
56
  }
66
57
  });
67
- async function getRenderHandler({ pwd, routes, config, cacheConfig, metaName, staticGenerate, onFallback }) {
58
+ async function getRenderHandler({ pwd, routes, config, cacheConfig, metaName, staticGenerate }) {
68
59
  const ssrConfig = config.server?.ssr;
69
60
  const ssrByEntries = config.server?.ssrByEntries;
70
61
  const forceCSR = 'object' == typeof ssrConfig ? ssrConfig.forceCSR : false;
@@ -81,8 +72,7 @@ async function getRenderHandler({ pwd, routes, config, cacheConfig, metaName, st
81
72
  forceCSR,
82
73
  forceCSRMap,
83
74
  nonce: config.security?.nonce,
84
- metaName: metaName || 'modern-js',
85
- onFallback
75
+ metaName: metaName || 'modern-js'
86
76
  });
87
77
  return render;
88
78
  }
@@ -108,7 +108,7 @@ var __webpack_exports__ = {};
108
108
  delete _headers.cookie;
109
109
  return _headers;
110
110
  }
111
- async function createRender({ routes, pwd, metaName, staticGenerate, cacheConfig, forceCSR, forceCSRMap, config, onFallback }) {
111
+ async function createRender({ routes, pwd, metaName, staticGenerate, cacheConfig, forceCSR, forceCSRMap, config }) {
112
112
  const router = getRouter(routes);
113
113
  return async (req, { monitors, nodeReq, templates, serverManifest, rscClientManifest, rscSSRManifest, rscServerManifest, locals, matchEntryName, matchPathname, loaderContext, contextForceCSR, reporter })=>{
114
114
  const forMatchpathname = matchPathname ?? (0, index_js_namespaceObject.getPathname)(req);
@@ -116,13 +116,14 @@ var __webpack_exports__ = {};
116
116
  const framework = (0, universal_namespaceObject.cutNameByHyphen)(metaName || 'modern-js');
117
117
  const fallbackHeader = `x-${framework}-ssr-fallback`;
118
118
  let fallbackReason = null;
119
- const fallbackContext = {
120
- request: req,
121
- monitors
122
- };
123
- const fallbackWrapper = async (reason, error)=>{
119
+ const fallbackWrapper = (reason)=>{
124
120
  fallbackReason = reason;
125
- return onFallback?.(reason, error, fallbackContext);
121
+ monitors?.warn('fallback to CSR reason: %o', {
122
+ type: reason
123
+ });
124
+ monitors?.counter('ssr-fallback', {
125
+ type: reason
126
+ });
126
127
  };
127
128
  if (!routeInfo) return new Response((0, index_js_namespaceObject.createErrorHtml)(404), {
128
129
  status: 404,
@@ -217,7 +218,7 @@ var __webpack_exports__ = {};
217
218
  response = await (0, external_ssrRender_js_namespaceObject.ssrRender)(request, options);
218
219
  } catch (e) {
219
220
  options.onError(e, index_js_namespaceObject.ErrorDigest.ERENDER);
220
- await fallbackWrapper('error', e);
221
+ fallbackWrapper('error');
221
222
  response = await csrRender(request, {
222
223
  ...options,
223
224
  html: injectFallbackReasonToHtml({
@@ -4,7 +4,6 @@ function getHookRunners(context) {
4
4
  config: (params)=>hooks.modifyConfig.call(params),
5
5
  prepare: ()=>hooks.onPrepare.call(),
6
6
  reset: (params)=>hooks.onReset.call(params),
7
- fallback: (input)=>hooks.fallback.call(input),
8
7
  prepareWebServer: (input)=>hooks.prepareWebServer.call(input),
9
8
  prepareApiServer: (input)=>hooks.prepareApiServer.call(input),
10
9
  afterMatch: (ctx)=>hooks.afterMatch.call(ctx),
@@ -1,9 +1,8 @@
1
- import { createAsyncHook, createAsyncPipelineHook } from "@modern-js/plugin";
1
+ import { createAsyncPipelineHook } from "@modern-js/plugin";
2
2
  import { getHookRunners, handleSetupResult } from "./hooks.mjs";
3
3
  const compatPlugin = ()=>({
4
4
  name: '@modern-js/server-compat',
5
5
  registryHooks: {
6
- fallback: createAsyncHook(),
7
6
  prepareWebServer: createAsyncPipelineHook(),
8
7
  prepareApiServer: createAsyncPipelineHook(),
9
8
  afterMatch: createAsyncPipelineHook(),
@@ -5,23 +5,14 @@ const injectRenderHandlerPlugin = ({ staticGenerate, cacheConfig })=>({
5
5
  api.onPrepare(async ()=>{
6
6
  const { distDirectory: pwd, routes, metaName } = api.getServerContext();
7
7
  const config = api.getServerConfig();
8
- const hooks = api.getHooks();
9
8
  if (!routes) return;
10
- const onFallback = async (reason, error, context)=>{
11
- await hooks.fallback.call({
12
- reason,
13
- error,
14
- context
15
- });
16
- };
17
9
  const getRenderHandlerOptions = {
18
10
  pwd: pwd,
19
11
  routes,
20
12
  config,
21
13
  metaName,
22
14
  cacheConfig: cacheConfig,
23
- staticGenerate,
24
- onFallback
15
+ staticGenerate
25
16
  };
26
17
  const render = await getRenderHandler(getRenderHandlerOptions);
27
18
  api.updateServerContext({
@@ -31,7 +22,7 @@ const injectRenderHandlerPlugin = ({ staticGenerate, cacheConfig })=>({
31
22
  });
32
23
  }
33
24
  });
34
- async function getRenderHandler({ pwd, routes, config, cacheConfig, metaName, staticGenerate, onFallback }) {
25
+ async function getRenderHandler({ pwd, routes, config, cacheConfig, metaName, staticGenerate }) {
35
26
  const ssrConfig = config.server?.ssr;
36
27
  const ssrByEntries = config.server?.ssrByEntries;
37
28
  const forceCSR = 'object' == typeof ssrConfig ? ssrConfig.forceCSR : false;
@@ -48,8 +39,7 @@ async function getRenderHandler({ pwd, routes, config, cacheConfig, metaName, st
48
39
  forceCSR,
49
40
  forceCSRMap,
50
41
  nonce: config.security?.nonce,
51
- metaName: metaName || 'modern-js',
52
- onFallback
42
+ metaName: metaName || 'modern-js'
53
43
  });
54
44
  return render;
55
45
  }
@@ -7,11 +7,10 @@ import { dataHandler } from "./dataHandler.mjs";
7
7
  import { renderRscHandler } from "./renderRscHandler.mjs";
8
8
  import { serverActionHandler } from "./serverActionHandler.mjs";
9
9
  import { ssrRender } from "./ssrRender.mjs";
10
- import { __webpack_require__ } from "../../rslib-runtime.mjs";
11
- import * as __rspack_external__modern_js_runtime_utils_router_4aa9f9b0 from "@modern-js/runtime-utils/router";
10
+ import { __webpack_require__ } from "../../rslib-runtime~1.mjs";
12
11
  __webpack_require__.add({
13
- 5327 (module) {
14
- module.exports = __rspack_external__modern_js_runtime_utils_router_4aa9f9b0;
12
+ 718 (module) {
13
+ module.exports = require("@modern-js/runtime-utils/router");
15
14
  }
16
15
  });
17
16
  const DYNAMIC_ROUTE_REG = /\/:./;
@@ -67,7 +66,7 @@ function getHeadersWithoutCookie(headers) {
67
66
  delete _headers.cookie;
68
67
  return _headers;
69
68
  }
70
- async function createRender({ routes, pwd, metaName, staticGenerate, cacheConfig, forceCSR, forceCSRMap, config, onFallback }) {
69
+ async function createRender({ routes, pwd, metaName, staticGenerate, cacheConfig, forceCSR, forceCSRMap, config }) {
71
70
  const router = getRouter(routes);
72
71
  return async (req, { monitors, nodeReq, templates, serverManifest, rscClientManifest, rscSSRManifest, rscServerManifest, locals, matchEntryName, matchPathname, loaderContext, contextForceCSR, reporter })=>{
73
72
  const forMatchpathname = matchPathname ?? getPathname(req);
@@ -75,13 +74,14 @@ async function createRender({ routes, pwd, metaName, staticGenerate, cacheConfig
75
74
  const framework = cutNameByHyphen(metaName || 'modern-js');
76
75
  const fallbackHeader = `x-${framework}-ssr-fallback`;
77
76
  let fallbackReason = null;
78
- const fallbackContext = {
79
- request: req,
80
- monitors
81
- };
82
- const fallbackWrapper = async (reason, error)=>{
77
+ const fallbackWrapper = (reason)=>{
83
78
  fallbackReason = reason;
84
- return onFallback?.(reason, error, fallbackContext);
79
+ monitors?.warn('fallback to CSR reason: %o', {
80
+ type: reason
81
+ });
82
+ monitors?.counter('ssr-fallback', {
83
+ type: reason
84
+ });
85
85
  };
86
86
  if (!routeInfo) return new Response(createErrorHtml(404), {
87
87
  status: 404,
@@ -162,7 +162,7 @@ async function renderHandler(request, options, mode, fallbackWrapper, framework)
162
162
  const { nestedRoutesJson } = serverManifest;
163
163
  const routes = nestedRoutesJson?.[options.routeInfo.entryName];
164
164
  if (routes) {
165
- const { matchRoutes } = __webpack_require__(5327);
165
+ const { matchRoutes } = __webpack_require__(718);
166
166
  const url = new URL(request.url);
167
167
  const matchedRoutes = matchRoutes(routes, url.pathname, options.routeInfo.urlPath);
168
168
  if (matchedRoutes) {
@@ -176,7 +176,7 @@ async function renderHandler(request, options, mode, fallbackWrapper, framework)
176
176
  response = await ssrRender(request, options);
177
177
  } catch (e) {
178
178
  options.onError(e, ErrorDigest.ERENDER);
179
- await fallbackWrapper('error', e);
179
+ fallbackWrapper('error');
180
180
  response = await csrRender(request, {
181
181
  ...options,
182
182
  html: injectFallbackReasonToHtml({
@@ -5,7 +5,6 @@ function getHookRunners(context) {
5
5
  config: (params)=>hooks.modifyConfig.call(params),
6
6
  prepare: ()=>hooks.onPrepare.call(),
7
7
  reset: (params)=>hooks.onReset.call(params),
8
- fallback: (input)=>hooks.fallback.call(input),
9
8
  prepareWebServer: (input)=>hooks.prepareWebServer.call(input),
10
9
  prepareApiServer: (input)=>hooks.prepareApiServer.call(input),
11
10
  afterMatch: (ctx)=>hooks.afterMatch.call(ctx),
@@ -1,10 +1,9 @@
1
1
  import "node:module";
2
- import { createAsyncHook, createAsyncPipelineHook } from "@modern-js/plugin";
2
+ import { createAsyncPipelineHook } from "@modern-js/plugin";
3
3
  import { getHookRunners, handleSetupResult } from "./hooks.mjs";
4
4
  const compatPlugin = ()=>({
5
5
  name: '@modern-js/server-compat',
6
6
  registryHooks: {
7
- fallback: createAsyncHook(),
8
7
  prepareWebServer: createAsyncPipelineHook(),
9
8
  prepareApiServer: createAsyncPipelineHook(),
10
9
  afterMatch: createAsyncPipelineHook(),
@@ -6,23 +6,14 @@ const injectRenderHandlerPlugin = ({ staticGenerate, cacheConfig })=>({
6
6
  api.onPrepare(async ()=>{
7
7
  const { distDirectory: pwd, routes, metaName } = api.getServerContext();
8
8
  const config = api.getServerConfig();
9
- const hooks = api.getHooks();
10
9
  if (!routes) return;
11
- const onFallback = async (reason, error, context)=>{
12
- await hooks.fallback.call({
13
- reason,
14
- error,
15
- context
16
- });
17
- };
18
10
  const getRenderHandlerOptions = {
19
11
  pwd: pwd,
20
12
  routes,
21
13
  config,
22
14
  metaName,
23
15
  cacheConfig: cacheConfig,
24
- staticGenerate,
25
- onFallback
16
+ staticGenerate
26
17
  };
27
18
  const render = await getRenderHandler(getRenderHandlerOptions);
28
19
  api.updateServerContext({
@@ -32,7 +23,7 @@ const injectRenderHandlerPlugin = ({ staticGenerate, cacheConfig })=>({
32
23
  });
33
24
  }
34
25
  });
35
- async function getRenderHandler({ pwd, routes, config, cacheConfig, metaName, staticGenerate, onFallback }) {
26
+ async function getRenderHandler({ pwd, routes, config, cacheConfig, metaName, staticGenerate }) {
36
27
  const ssrConfig = config.server?.ssr;
37
28
  const ssrByEntries = config.server?.ssrByEntries;
38
29
  const forceCSR = 'object' == typeof ssrConfig ? ssrConfig.forceCSR : false;
@@ -49,8 +40,7 @@ async function getRenderHandler({ pwd, routes, config, cacheConfig, metaName, st
49
40
  forceCSR,
50
41
  forceCSRMap,
51
42
  nonce: config.security?.nonce,
52
- metaName: metaName || 'modern-js',
53
- onFallback
43
+ metaName: metaName || 'modern-js'
54
44
  });
55
45
  return render;
56
46
  }
@@ -8,11 +8,12 @@ import { dataHandler } from "./dataHandler.mjs";
8
8
  import { renderRscHandler } from "./renderRscHandler.mjs";
9
9
  import { serverActionHandler } from "./serverActionHandler.mjs";
10
10
  import { ssrRender } from "./ssrRender.mjs";
11
- import { __webpack_require__ } from "../../rslib-runtime.mjs";
12
- import * as __rspack_external__modern_js_runtime_utils_router_4aa9f9b0 from "@modern-js/runtime-utils/router";
11
+ import { __webpack_require__ } from "../../rslib-runtime~0.mjs";
12
+ import { createRequire as __rspack_createRequire } from "node:module";
13
+ const __rspack_createRequire_require = __rspack_createRequire(import.meta.url);
13
14
  __webpack_require__.add({
14
15
  "@modern-js/runtime-utils/router" (module) {
15
- module.exports = __rspack_external__modern_js_runtime_utils_router_4aa9f9b0;
16
+ module.exports = __rspack_createRequire_require("@modern-js/runtime-utils/router");
16
17
  }
17
18
  });
18
19
  const DYNAMIC_ROUTE_REG = /\/:./;
@@ -68,7 +69,7 @@ function getHeadersWithoutCookie(headers) {
68
69
  delete _headers.cookie;
69
70
  return _headers;
70
71
  }
71
- async function createRender({ routes, pwd, metaName, staticGenerate, cacheConfig, forceCSR, forceCSRMap, config, onFallback }) {
72
+ async function createRender({ routes, pwd, metaName, staticGenerate, cacheConfig, forceCSR, forceCSRMap, config }) {
72
73
  const router = getRouter(routes);
73
74
  return async (req, { monitors, nodeReq, templates, serverManifest, rscClientManifest, rscSSRManifest, rscServerManifest, locals, matchEntryName, matchPathname, loaderContext, contextForceCSR, reporter })=>{
74
75
  const forMatchpathname = matchPathname ?? getPathname(req);
@@ -76,13 +77,14 @@ async function createRender({ routes, pwd, metaName, staticGenerate, cacheConfig
76
77
  const framework = cutNameByHyphen(metaName || 'modern-js');
77
78
  const fallbackHeader = `x-${framework}-ssr-fallback`;
78
79
  let fallbackReason = null;
79
- const fallbackContext = {
80
- request: req,
81
- monitors
82
- };
83
- const fallbackWrapper = async (reason, error)=>{
80
+ const fallbackWrapper = (reason)=>{
84
81
  fallbackReason = reason;
85
- return onFallback?.(reason, error, fallbackContext);
82
+ monitors?.warn('fallback to CSR reason: %o', {
83
+ type: reason
84
+ });
85
+ monitors?.counter('ssr-fallback', {
86
+ type: reason
87
+ });
86
88
  };
87
89
  if (!routeInfo) return new Response(createErrorHtml(404), {
88
90
  status: 404,
@@ -177,7 +179,7 @@ async function renderHandler(request, options, mode, fallbackWrapper, framework)
177
179
  response = await ssrRender(request, options);
178
180
  } catch (e) {
179
181
  options.onError(e, ErrorDigest.ERENDER);
180
- await fallbackWrapper('error', e);
182
+ fallbackWrapper('error');
181
183
  response = await csrRender(request, {
182
184
  ...options,
183
185
  html: injectFallbackReasonToHtml({
@@ -1,6 +1,6 @@
1
- export { loadServerEnv } from './loadEnv';
2
- export { loadServerPlugins } from './loadPlugin';
3
- export { loadServerRuntimeConfig, loadServerCliConfig } from './loadConfig';
4
- export { loadCacheConfig } from './loadCache';
5
- export { isResFinalized } from './utils';
6
- export type { NodeBindings } from './utils';
1
+ export { loadServerEnv } from './loadEnv.js';
2
+ export { loadServerPlugins } from './loadPlugin.js';
3
+ export { loadServerRuntimeConfig, loadServerCliConfig } from './loadConfig.js';
4
+ export { loadCacheConfig } from './loadCache.js';
5
+ export { isResFinalized } from './utils.js';
6
+ export type { NodeBindings } from './utils.js';
@@ -1,2 +1,2 @@
1
- import type { CacheConfig } from '../../../types';
1
+ import type { CacheConfig } from '../../../types/index.js';
2
2
  export declare function loadCacheConfig(pwd: string): Promise<CacheConfig | undefined>;
@@ -1,3 +1,3 @@
1
- import type { CliConfig, ServerConfig, UserConfig } from '../../../types';
1
+ import type { CliConfig, ServerConfig, UserConfig } from '../../../types/index.js';
2
2
  export declare function loadServerRuntimeConfig(serverConfigPath: string): Promise<ServerConfig | undefined>;
3
3
  export declare function loadServerCliConfig(pwd: string, defaultConfig?: UserConfig): CliConfig;
@@ -1,3 +1,3 @@
1
- import type { ServerBaseOptions } from '../../../serverBase';
1
+ import type { ServerBaseOptions } from '../../../serverBase.js';
2
2
  /** 读取 .env.{process.env.MODERN_ENV} 文件,加载环境变量 */
3
3
  export declare function loadServerEnv(options: ServerBaseOptions): Promise<void>;
@@ -1,3 +1,3 @@
1
1
  import type { ServerPlugin } from '@modern-js/types';
2
- import type { ServerPlugin as ServerPluginInstance } from '../../../types';
2
+ import type { ServerPlugin as ServerPluginInstance } from '../../../types/index.js';
3
3
  export declare function loadServerPlugins(serverPlugins: ServerPlugin[], appDirectory: string): Promise<ServerPluginInstance[]>;
@@ -1,5 +1,5 @@
1
1
  import type { ClientManifest, NodeRequest, NodeResponse, SSRManifest } from '@modern-js/types/server';
2
- import type { HonoRequest, ServerManifest } from '../../../types';
2
+ import type { HonoRequest, ServerManifest } from '../../../types/index.js';
3
3
  type ExtendedNodeRequest = NodeRequest & {
4
4
  __honoRequest?: HonoRequest;
5
5
  __templates?: Record<string, string>;
@@ -1,6 +1,6 @@
1
1
  import type { NodeRequest, NodeResponse } from '@modern-js/types/server';
2
- import type { Context, Middleware, Next, ServerEnv } from '../../types';
3
- import { type NodeBindings } from './helper';
2
+ import type { Context, Middleware, Next, ServerEnv } from '../../types/index.js';
3
+ import { type NodeBindings } from './helper/index.js';
4
4
  export type ServerNodeEnv = {
5
5
  Bindings: NodeBindings;
6
6
  };
@@ -1,5 +1,5 @@
1
- export { httpCallBack2HonoMid, connectMid2HonoMid, connectMockMid2HonoMid, } from './hono';
2
- export type { ServerNodeContext, ServerNodeMiddleware } from './hono';
3
- export { createNodeServer, sendResponse, createWebRequest, } from './node';
4
- export { serverStaticPlugin, injectResourcePlugin, getHtmlTemplates, getServerManifest, injectNodeSeverPlugin, injectRscManifestPlugin, } from './plugins';
5
- export { loadServerPlugins, loadServerEnv, loadServerRuntimeConfig, loadServerCliConfig, loadCacheConfig, } from './helper';
1
+ export { httpCallBack2HonoMid, connectMid2HonoMid, connectMockMid2HonoMid, } from './hono.js';
2
+ export type { ServerNodeContext, ServerNodeMiddleware } from './hono.js';
3
+ export { createNodeServer, sendResponse, createWebRequest, } from './node.js';
4
+ export { serverStaticPlugin, injectResourcePlugin, getHtmlTemplates, getServerManifest, injectNodeSeverPlugin, injectRscManifestPlugin, } from './plugins/index.js';
5
+ export { loadServerPlugins, loadServerEnv, loadServerRuntimeConfig, loadServerCliConfig, loadCacheConfig, } from './helper/index.js';
@@ -2,7 +2,7 @@ import { type Server as NodeServer } from 'node:http';
2
2
  import type { Http2SecureServer } from 'node:http2';
3
3
  import type { Server as NodeHttpsServer } from 'node:https';
4
4
  import type { NodeRequest, NodeResponse } from '@modern-js/types/server';
5
- import type { RequestHandler } from '../../types';
5
+ import type { RequestHandler } from '../../types/index.js';
6
6
  export declare const createWebRequest: (req: NodeRequest, res: NodeResponse, body?: BodyInit) => Request;
7
7
  export declare const sendResponse: (response: Response, res: NodeResponse) => Promise<void>;
8
8
  declare const getRequestListener: (handler: RequestHandler) => (req: NodeRequest, res: NodeResponse) => Promise<void>;
@@ -1,3 +1,3 @@
1
- export * from './static';
2
- export * from './resource';
3
- export * from './nodeServer';
1
+ export * from './static.js';
2
+ export * from './resource.js';
3
+ export * from './nodeServer.js';
@@ -1,6 +1,6 @@
1
1
  import type { Server as NodeServer } from 'node:http';
2
2
  import type { Http2SecureServer } from 'node:http2';
3
- import type { ServerPlugin } from '../../../types';
3
+ import type { ServerPlugin } from '../../../types/index.js';
4
4
  export declare const injectNodeSeverPlugin: ({ nodeServer, }: {
5
5
  nodeServer: NodeServer | Http2SecureServer;
6
6
  }) => ServerPlugin;
@@ -1,5 +1,5 @@
1
1
  import type { Monitors, ServerRoute } from '@modern-js/types';
2
- import type { Middleware, ServerEnv, ServerManifest, ServerPlugin } from '../../../types';
2
+ import type { Middleware, ServerEnv, ServerManifest, ServerPlugin } from '../../../types/index.js';
3
3
  export declare function getHtmlTemplates(pwd: string, routes: ServerRoute[]): Promise<Record<string, string>>;
4
4
  export declare function injectTemplates(pwd: string, routes?: ServerRoute[], htmlTemplatePromise?: ReturnType<typeof getHtmlTemplates>): Middleware<ServerEnv>;
5
5
  export declare function getServerManifest(pwd: string, routes: ServerRoute[], monitors?: Monitors): Promise<ServerManifest>;
@@ -1,5 +1,5 @@
1
1
  import type { ServerRoute } from '@modern-js/types';
2
- import type { HtmlNormalizedConfig, Middleware, OutputNormalizedConfig, ServerNormalizedConfig, ServerPlugin } from '../../../types';
2
+ import type { HtmlNormalizedConfig, Middleware, OutputNormalizedConfig, ServerNormalizedConfig, ServerPlugin } from '../../../types/index.js';
3
3
  export declare const serverStaticPlugin: () => ServerPlugin;
4
4
  export type PublicMiddlwareOptions = {
5
5
  pwd: string;
@@ -1,4 +1,4 @@
1
- import type { Context } from './types';
1
+ import type { Context } from './types/index.js';
2
2
  type LoaderContext = Map<string, unknown>;
3
3
  type Var = {
4
4
  loaderContext: LoaderContext;
@@ -1,14 +1,14 @@
1
- export { createErrorHtml, onError, ErrorDigest } from './utils';
2
- export { normalizePublicDir, normalizePublicDirPath, getPublicDirRoutePrefixes, getPublicDirPatterns, resolvePublicDirPaths, getPublicDirConfig, } from './utils/publicDir';
3
- export { AGGRED_DIR } from './constants';
4
- export type { ServerBase, ServerBaseOptions } from './serverBase';
5
- export { createServerBase } from './serverBase';
6
- export { run, useHonoContext } from './context';
1
+ export { createErrorHtml, onError, ErrorDigest } from './utils/index.js';
2
+ export { normalizePublicDir, normalizePublicDirPath, getPublicDirRoutePrefixes, getPublicDirPatterns, resolvePublicDirPaths, getPublicDirConfig, } from './utils/publicDir.js';
3
+ export { AGGRED_DIR } from './constants.js';
4
+ export type { ServerBase, ServerBaseOptions } from './serverBase.js';
5
+ export { createServerBase } from './serverBase.js';
6
+ export { run, useHonoContext } from './context.js';
7
7
  export { Hono } from 'hono';
8
- export type { Middleware, MiddlewareHandler, Context, Next, HonoRequest as InternalRequest, ServerEnv, ServerManifest, ServerLoaderBundle, } from './types';
9
- export { getLoaderCtx } from './helper';
10
- export * from './plugins';
11
- export * from './types/plugins';
12
- export * from './types/render';
13
- export * from './types/config';
14
- export * from './types/requestHandler';
8
+ export type { Middleware, MiddlewareHandler, Context, Next, HonoRequest as InternalRequest, ServerEnv, ServerManifest, ServerLoaderBundle, } from './types/index.js';
9
+ export { getLoaderCtx } from './helper.js';
10
+ export * from './plugins/index.js';
11
+ export * from './types/plugins/index.js';
12
+ export * from './types/render.js';
13
+ export * from './types/config/index.js';
14
+ export * from './types/requestHandler.js';
@@ -1,5 +1,5 @@
1
1
  import type { InternalServerContext } from '@modern-js/plugin';
2
- import type { ServerPluginExtends } from '../../types';
2
+ import type { ServerPluginExtends } from '../../types/index.js';
3
3
  /**
4
4
  * old plugin useHookRunners function result
5
5
  */
@@ -1,3 +1,3 @@
1
- import type { ServerPlugin } from '../../types';
2
- export { handleSetupResult } from './hooks';
1
+ import type { ServerPlugin } from '../../types/index.js';
2
+ export { handleSetupResult } from './hooks.js';
3
3
  export declare const compatPlugin: () => ServerPlugin;
@@ -1,6 +1,6 @@
1
1
  import type { Logger } from '@modern-js/types';
2
- import type { ServerPlugin } from '../types';
3
- import { type InjectRenderHandlerOptions } from './render';
2
+ import type { ServerPlugin } from '../types/index.js';
3
+ import { type InjectRenderHandlerOptions } from './render/index.js';
4
4
  export type CreateDefaultPluginsOptions = InjectRenderHandlerOptions & {
5
5
  logger?: Logger | false;
6
6
  };
@@ -1,2 +1,2 @@
1
- import type { ServerPlugin } from '../types';
1
+ import type { ServerPlugin } from '../types/index.js';
2
2
  export declare const faviconPlugin: () => ServerPlugin;
@@ -1,8 +1,8 @@
1
- export { renderPlugin, injectRenderHandlerPlugin, type InjectRenderHandlerOptions, getRenderHandler, } from './render';
2
- export { faviconPlugin } from './favicon';
3
- export { injectServerTiming, injectloggerPlugin } from './monitors';
4
- export { processedByPlugin } from './processedBy';
5
- export { logPlugin } from './log';
6
- export { createDefaultPlugins, type CreateDefaultPluginsOptions, } from './default';
7
- export { compatPlugin, handleSetupResult } from './compat';
8
- export { injectConfigMiddlewarePlugin } from './middlewares';
1
+ export { renderPlugin, injectRenderHandlerPlugin, type InjectRenderHandlerOptions, getRenderHandler, } from './render/index.js';
2
+ export { faviconPlugin } from './favicon.js';
3
+ export { injectServerTiming, injectloggerPlugin } from './monitors.js';
4
+ export { processedByPlugin } from './processedBy.js';
5
+ export { logPlugin } from './log.js';
6
+ export { createDefaultPlugins, type CreateDefaultPluginsOptions, } from './default.js';
7
+ export { compatPlugin, handleSetupResult } from './compat/index.js';
8
+ export { injectConfigMiddlewarePlugin } from './middlewares.js';
@@ -1,2 +1,2 @@
1
- import type { ServerPlugin } from '../types';
1
+ import type { ServerPlugin } from '../types/index.js';
2
2
  export declare const logPlugin: () => ServerPlugin;
@@ -1,2 +1,2 @@
1
- import type { MiddlewareObj, ServerPlugin } from '../types';
1
+ import type { MiddlewareObj, ServerPlugin } from '../types/index.js';
2
2
  export declare const injectConfigMiddlewarePlugin: (configMiddlewares?: MiddlewareObj[], configRenderMiddlewares?: MiddlewareObj[]) => ServerPlugin;
@@ -1,5 +1,5 @@
1
1
  import type { Logger } from '@modern-js/types';
2
- import type { Context, Next, ServerEnv, ServerPlugin } from '../types';
2
+ import type { Context, Next, ServerEnv, ServerPlugin } from '../types/index.js';
3
3
  export declare const initMonitorsPlugin: () => ServerPlugin;
4
4
  export declare const injectloggerPlugin: (inputLogger: Logger) => ServerPlugin;
5
5
  export declare const injectServerTiming: () => ServerPlugin;
@@ -1,2 +1,2 @@
1
- import type { ServerPlugin } from '../types';
1
+ import type { ServerPlugin } from '../types/index.js';
2
2
  export declare const processedByPlugin: () => ServerPlugin;
@@ -1,2 +1,2 @@
1
- import type { SSRRenderOptions } from './ssrRender';
1
+ import type { SSRRenderOptions } from './ssrRender.js';
2
2
  export declare const csrRscRender: (req: Request, options: SSRRenderOptions) => Promise<Response>;
@@ -1,5 +1,5 @@
1
1
  import type { ServerRoute } from '@modern-js/types';
2
- import type { SSRRenderOptions } from './ssrRender';
2
+ import type { SSRRenderOptions } from './ssrRender.js';
3
3
  export declare const dataHandler: (request: Request, { routeInfo, serverRoutes, monitors, onError, onTiming, serverManifest, loaderContext, }: SSRRenderOptions & {
4
4
  serverRoutes: ServerRoute[];
5
5
  }) => Promise<Response | void>;
@@ -1,3 +1,3 @@
1
- import type { ServerPlugin } from '../../types';
2
- export * from './inject';
1
+ import type { ServerPlugin } from '../../types/index.js';
2
+ export * from './inject.js';
3
3
  export declare const renderPlugin: () => ServerPlugin;
@@ -1,7 +1,7 @@
1
- import type { CacheConfig, GetRenderHandlerOptions, Render, ServerPlugin } from '../../types';
1
+ import type { CacheConfig, GetRenderHandlerOptions, Render, ServerPlugin } from '../../types/index.js';
2
2
  export interface InjectRenderHandlerOptions {
3
3
  staticGenerate?: boolean;
4
4
  cacheConfig?: CacheConfig;
5
5
  }
6
6
  export declare const injectRenderHandlerPlugin: ({ staticGenerate, cacheConfig, }: InjectRenderHandlerOptions) => ServerPlugin;
7
- export declare function getRenderHandler({ pwd, routes, config, cacheConfig, metaName, staticGenerate, onFallback, }: GetRenderHandlerOptions): Promise<Render>;
7
+ export declare function getRenderHandler({ pwd, routes, config, cacheConfig, metaName, staticGenerate, }: GetRenderHandlerOptions): Promise<Render>;
@@ -1,15 +1,14 @@
1
1
  import type { ServerRoute } from '@modern-js/types';
2
2
  import type { Router } from 'hono/router';
3
- import type { CacheConfig, OnFallback, UserConfig } from '../../types';
4
- import type { Render } from '../../types';
5
- import type { Params } from '../../types/requestHandler';
3
+ import type { CacheConfig, UserConfig } from '../../types/index.js';
4
+ import type { Render } from '../../types/index.js';
5
+ import type { Params } from '../../types/requestHandler.js';
6
6
  interface CreateRenderOptions {
7
7
  pwd: string;
8
8
  routes: ServerRoute[];
9
9
  config: UserConfig;
10
10
  cacheConfig?: CacheConfig;
11
11
  staticGenerate?: boolean;
12
- onFallback?: OnFallback;
13
12
  metaName?: string;
14
13
  forceCSR?: boolean;
15
14
  forceCSRMap?: Map<string, boolean>;
@@ -17,5 +16,5 @@ interface CreateRenderOptions {
17
16
  }
18
17
  type MatchedRoute = [ServerRoute | undefined, Params];
19
18
  export declare function matchRoute(router: Router<ServerRoute>, pathname: string, entryName?: string): MatchedRoute;
20
- export declare function createRender({ routes, pwd, metaName, staticGenerate, cacheConfig, forceCSR, forceCSRMap, config, onFallback, }: CreateRenderOptions): Promise<Render>;
19
+ export declare function createRender({ routes, pwd, metaName, staticGenerate, cacheConfig, forceCSR, forceCSRMap, config, }: CreateRenderOptions): Promise<Render>;
21
20
  export {};
@@ -1,2 +1,2 @@
1
- import type { SSRRenderOptions } from './ssrRender';
1
+ import type { SSRRenderOptions } from './ssrRender.js';
2
2
  export declare const renderRscHandler: (req: Request, options: SSRRenderOptions) => Promise<Response>;
@@ -1,2 +1,2 @@
1
- import type { SSRRenderOptions } from './ssrRender';
1
+ import type { SSRRenderOptions } from './ssrRender.js';
2
2
  export declare const serverActionHandler: (req: Request, { serverManifest, routeInfo, rscClientManifest }: SSRRenderOptions) => Promise<Response>;
@@ -1,6 +1,6 @@
1
1
  import type { CacheControl, CacheOption, Container } from '@modern-js/types';
2
2
  import type { NodeRequest } from '@modern-js/types/server';
3
- import type { RequestHandler, RequestHandlerOptions } from '../../types/requestHandler';
3
+ import type { RequestHandler, RequestHandlerOptions } from '../../types/requestHandler.js';
4
4
  export type CacheStatus = 'hit' | 'stale' | 'expired' | 'miss';
5
5
  type MaybeAsync<T> = Promise<T> | T;
6
6
  /**
@@ -1,8 +1,8 @@
1
1
  import type { Reporter, ServerRoute } from '@modern-js/types';
2
2
  import type { Monitors, ClientManifest as RscClientManifest, SSRManifest as RscSSRManifest, ServerManifest as RscServerManifest } from '@modern-js/types/server';
3
3
  import type { NodeRequest } from '@modern-js/types/server';
4
- import type { CacheConfig, ServerManifest, UserConfig } from '../../types';
5
- import type { OnError, OnTiming, Params } from '../../types/requestHandler';
4
+ import type { CacheConfig, ServerManifest, UserConfig } from '../../types/index.js';
5
+ import type { OnError, OnTiming, Params } from '../../types/requestHandler.js';
6
6
  export interface SSRRenderOptions {
7
7
  pwd: string;
8
8
  html: string;
@@ -1,3 +1,3 @@
1
- import type { UserConfig } from '../../types';
2
- import type { RequestHandlerConfig } from '../../types/requestHandler';
1
+ import type { UserConfig } from '../../types/index.js';
2
+ import type { RequestHandlerConfig } from '../../types/requestHandler.js';
3
3
  export declare function createRequestHandlerConfig(userConfig: UserConfig): RequestHandlerConfig;
@@ -1,2 +1,2 @@
1
- import type { ServerPlugin } from '../types';
1
+ import type { ServerPlugin } from '../types/index.js';
2
2
  export declare const injectRoutePlugin: () => ServerPlugin;
@@ -1,6 +1,6 @@
1
1
  import { type ServerCreateOptions } from '@modern-js/plugin/server';
2
- import type { Env, ServerConfig, ServerPlugin, ServerPluginHooks } from './types';
3
- import type { CliConfig } from './types/config';
2
+ import type { Env, ServerConfig, ServerPlugin, ServerPluginHooks } from './types/index.js';
3
+ import type { CliConfig } from './types/config/index.js';
4
4
  export interface ServerBaseOptions extends ServerCreateOptions {
5
5
  /** server working directory, and then also dist directory */
6
6
  config: CliConfig;
@@ -1,17 +1,17 @@
1
- import type { BffNormalizedConfig, BffUserConfig } from './bff';
2
- import type { DevNormalizedConfig, DevUserConfig } from './dev';
3
- import type { HtmlNormalizedConfig, HtmlUserConfig } from './html';
4
- import type { OutputNormalizedConfig, OutputUserConfig } from './output';
5
- import type { SecurityNormalizedConfig, SecurityUserConfig } from './security';
6
- import type { ServerNormalizedConfig, ServerUserConfig } from './server';
7
- import type { SourceNormalizedConfig, SourceUserConfig } from './source';
8
- import type { ToolsNormalizedConfig, ToolsUserConfig } from './tools';
9
- export * from './bff';
10
- export * from './html';
11
- export * from './output';
12
- export * from './server';
13
- export * from './source';
14
- export * from './tools';
1
+ import type { BffNormalizedConfig, BffUserConfig } from './bff.js';
2
+ import type { DevNormalizedConfig, DevUserConfig } from './dev.js';
3
+ import type { HtmlNormalizedConfig, HtmlUserConfig } from './html.js';
4
+ import type { OutputNormalizedConfig, OutputUserConfig } from './output.js';
5
+ import type { SecurityNormalizedConfig, SecurityUserConfig } from './security.js';
6
+ import type { ServerNormalizedConfig, ServerUserConfig } from './server.js';
7
+ import type { SourceNormalizedConfig, SourceUserConfig } from './source.js';
8
+ import type { ToolsNormalizedConfig, ToolsUserConfig } from './tools.js';
9
+ export * from './bff.js';
10
+ export * from './html.js';
11
+ export * from './output.js';
12
+ export * from './server.js';
13
+ export * from './source.js';
14
+ export * from './tools.js';
15
15
  export interface UserConfig {
16
16
  output?: OutputUserConfig;
17
17
  source?: SourceUserConfig;
@@ -1,5 +1,5 @@
1
1
  import type { Alias } from '@modern-js/utils';
2
- import type { ConfigChain } from './share';
2
+ import type { ConfigChain } from './share.js';
3
3
  export interface SourceUserConfig {
4
4
  alias?: ConfigChain<Alias>;
5
5
  enableAsyncEntry?: boolean;
@@ -1,4 +1,4 @@
1
- export * from './config';
2
- export * from './plugins';
3
- export * from './render';
4
- export * from './server';
1
+ export * from './config/index.js';
2
+ export * from './plugins/index.js';
3
+ export * from './render.js';
4
+ export * from './server.js';
@@ -1,20 +1,9 @@
1
- import type { CacheOption, Container, HttpMethodDecider, MiddlewareContext, Monitors, ServerRoute } from '@modern-js/types';
1
+ import type { CacheOption, Container, HttpMethodDecider, MiddlewareContext, ServerRoute } from '@modern-js/types';
2
2
  import type { Context, MiddlewareHandler } from 'hono';
3
- import type { UserConfig } from '../config';
4
- import type { Render } from '../render';
5
- import type { ServerPlugin } from './plugin';
3
+ import type { UserConfig } from '../config/index.js';
4
+ import type { Render } from '../render.js';
5
+ import type { ServerPlugin } from './plugin.js';
6
6
  export type { FileChangeEvent, ResetEvent } from '@modern-js/plugin';
7
- export type FallbackReason = 'error' | 'header' | 'query' | `header,${string}`;
8
- export type FallbackContext = {
9
- request: Request;
10
- monitors?: Monitors;
11
- };
12
- export type FallbackInput = {
13
- reason: FallbackReason;
14
- error: unknown;
15
- context?: FallbackContext;
16
- };
17
- export type OnFallback = (reason: FallbackReason, error?: unknown, context?: FallbackContext) => Promise<void>;
18
7
  export type APIServerStartInput = {
19
8
  pwd: string;
20
9
  prefix?: string;
@@ -44,7 +33,6 @@ export interface GetRenderHandlerOptions {
44
33
  pwd: string;
45
34
  routes: ServerRoute[];
46
35
  config: UserConfig;
47
- onFallback?: OnFallback;
48
36
  cacheConfig?: CacheConfig;
49
37
  staticGenerate?: boolean;
50
38
  metaName?: string;
@@ -1,2 +1,2 @@
1
- export * from './plugin';
2
- export type { ServerConfig, CacheConfig, OnFallback, FallbackReason, FallbackContext, GetRenderHandlerOptions, FileChangeEvent, FallbackInput, WebServerStartInput, APIServerStartInput, ServerMiddleware, MiddlewareObj, } from './base';
1
+ export * from './plugin.js';
2
+ export type { ServerConfig, CacheConfig, GetRenderHandlerOptions, FileChangeEvent, WebServerStartInput, APIServerStartInput, ServerMiddleware, MiddlewareObj, } from './base.js';
@@ -1,10 +1,9 @@
1
- import type { AsyncHook, AsyncPipelineHook, ServerContext as BaseServerContext, ServerPlugin as BaseServerPlugin, ServerPluginAPI as BaseServerPluginAPI, ServerPluginExtends as BaseServerPluginExtends } from '@modern-js/plugin';
1
+ import type { AsyncPipelineHook, ServerContext as BaseServerContext, ServerPlugin as BaseServerPlugin, ServerPluginAPI as BaseServerPluginAPI, ServerPluginExtends as BaseServerPluginExtends } from '@modern-js/plugin';
2
2
  import type { Hooks } from '@modern-js/plugin/server';
3
3
  import type { AfterMatchContext, AfterRenderContext, AfterStreamingRenderContext } from '@modern-js/types';
4
4
  import type { MiddlewareHandler } from 'hono';
5
- import type { MiddlewareObj } from './base';
6
- import type { APIServerStartInput, FallbackInput, ServerConfig, WebAdapter, WebServerStartInput } from './base';
7
- export type FallbackFn = (input: FallbackInput) => Promise<FallbackInput>;
5
+ import type { MiddlewareObj } from './base.js';
6
+ import type { APIServerStartInput, ServerConfig, WebAdapter, WebServerStartInput } from './base.js';
8
7
  export type PrepareWebServerFn = (input: WebServerStartInput) => Promise<WebAdapter | null>;
9
8
  export type PrepareApiServerFn = (input: APIServerStartInput) => Promise<MiddlewareHandler>;
10
9
  export type AfterMatchFn = (ctx: AfterMatchContext) => Promise<any>;
@@ -19,7 +18,6 @@ export interface ServerPluginExtends extends BaseServerPluginExtends {
19
18
  };
20
19
  extendHooks: {
21
20
  prepareWebServer: AsyncPipelineHook<PrepareWebServerFn>;
22
- fallback: AsyncHook<FallbackFn>;
23
21
  prepareApiServer: AsyncPipelineHook<PrepareApiServerFn>;
24
22
  afterMatch: AsyncPipelineHook<AfterMatchFn>;
25
23
  afterRender: AsyncPipelineHook<AfterRenderFn>;
@@ -1,6 +1,6 @@
1
1
  import type { Monitors, Reporter, ClientManifest as RscClientManifest, SSRManifest as RscSSRManifest, ServerManifest as RscServerManifest } from '@modern-js/types';
2
2
  import type { NodeRequest } from '@modern-js/types/server';
3
- import type { ServerManifest } from './server';
3
+ import type { ServerManifest } from './server.js';
4
4
  export interface RenderOptions {
5
5
  monitors: Monitors;
6
6
  loaderContext?: Map<string, unknown>;
@@ -1,6 +1,6 @@
1
1
  import type { Reporter, ServerRoute } from '@modern-js/types';
2
2
  import type { Monitors, ClientManifest as RscClientManifest, SSRManifest as RscSSRManifest, ServerManifest as RscServerManifest } from '@modern-js/types/server';
3
- import type { ServerUserConfig, SourceUserConfig } from './config';
3
+ import type { ServerUserConfig, SourceUserConfig } from './config/index.js';
4
4
  export type Resource = {
5
5
  loadableStats: Record<string, any>;
6
6
  routeManifest: Record<string, any>;
@@ -1,6 +1,6 @@
1
1
  import type { Logger, Metrics, Monitors, NestedRoute, Reporter, ServerRoute } from '@modern-js/types';
2
2
  import type { ClientManifest as RscClientManifest, SSRManifest as RscSSRManifest, ServerManifest as RscServerManifest } from '@modern-js/types/server';
3
- import type { RequestHandler as BundleRequestHandler, OnError, OnTiming, RequestHandlerOptions, Resource } from './requestHandler';
3
+ import type { RequestHandler as BundleRequestHandler, OnError, OnTiming, RequestHandlerOptions, Resource } from './requestHandler.js';
4
4
  export type RequestHandler = (request: Request, ...args: any[]) => Response | Promise<Response>;
5
5
  export type ServerLoaderBundle = {
6
6
  routes: NestedRoute[];
@@ -1,9 +1,9 @@
1
- export * from './env';
2
- export * from './transformStream';
3
- export * from './middlewareCollector';
4
- export * from './error';
5
- export * from './warmup';
6
- export * from './entry';
7
- export * from './request';
8
- export * from './serverConfig';
9
- export * from './publicDir';
1
+ export * from './env.js';
2
+ export * from './transformStream.js';
3
+ export * from './middlewareCollector.js';
4
+ export * from './error.js';
5
+ export * from './warmup.js';
6
+ export * from './entry.js';
7
+ export * from './request.js';
8
+ export * from './serverConfig.js';
9
+ export * from './publicDir.js';
@@ -1,4 +1,4 @@
1
- import type { ServerNormalizedConfig } from '../types';
1
+ import type { ServerNormalizedConfig } from '../types/index.js';
2
2
  /**
3
3
  * Normalize publicDir configuration to an array of strings
4
4
  * @param publicDir - publicDir configuration (string | string[] | undefined)
@@ -1,4 +1,4 @@
1
- import type { CliConfig, ServerConfig } from '../types';
1
+ import type { CliConfig, ServerConfig } from '../types/index.js';
2
2
  /**
3
3
  * 对配置进行合并,cliConfig 与 serverConfig 进行深合并
4
4
  */
package/package.json CHANGED
@@ -15,7 +15,7 @@
15
15
  "modern",
16
16
  "modern.js"
17
17
  ],
18
- "version": "3.8.3",
18
+ "version": "3.9.1",
19
19
  "types": "./dist/types/index.d.ts",
20
20
  "main": "./dist/cjs/index.js",
21
21
  "exports": {
@@ -71,19 +71,19 @@
71
71
  "flatted": "^3.4.4",
72
72
  "hono": "^4.11.7",
73
73
  "ts-deepmerge": "7.0.3",
74
- "@modern-js/plugin": "3.8.3",
75
- "@modern-js/runtime-utils": "3.8.3",
76
- "@modern-js/utils": "3.8.3"
74
+ "@modern-js/plugin": "3.9.1",
75
+ "@modern-js/runtime-utils": "3.9.1",
76
+ "@modern-js/utils": "3.9.1"
77
77
  },
78
78
  "devDependencies": {
79
- "@rslib/core": "0.23.2",
79
+ "@rslib/core": "1.0.0",
80
80
  "@types/cloneable-readable": "^2.0.3",
81
81
  "@types/merge-deep": "^3.0.3",
82
82
  "@types/node": "^20",
83
83
  "http-proxy-middleware": "^2.0.10",
84
84
  "typescript": "^5",
85
85
  "@modern-js/rslib": "2.68.10",
86
- "@modern-js/types": "3.8.3",
86
+ "@modern-js/types": "3.9.1",
87
87
  "@scripts/rstest-config": "2.66.0"
88
88
  },
89
89
  "sideEffects": false,